From 9c5e21045dd1138750868ed307110778ef4f4bc3 Mon Sep 17 00:00:00 2001 From: Stephan Dollberg Date: Wed, 25 Apr 2018 02:35:12 +0100 Subject: [PATCH] Make gsl::details::throw_exception not copy exception object (#667) This fixes the build with clang 7 which introduces a new warning `-Wreturn-std-move` which warns about needless copies when a move operation is available (see https://reviews.llvm.org/rL329914). We take the exception object by uref so we should throw the forwarded version. --- include/gsl/gsl_assert | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert index 2bda149..3f5746a 100644 --- a/include/gsl/gsl_assert +++ b/include/gsl/gsl_assert @@ -113,7 +113,7 @@ namespace details template [[noreturn]] void throw_exception(Exception&& exception) { - throw exception; + throw std::forward(exception); } #endif