diff options
Diffstat (limited to 'clang/test/SemaCXX/statements.cpp')
| -rw-r--r-- | clang/test/SemaCXX/statements.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/statements.cpp b/clang/test/SemaCXX/statements.cpp index 48f178d..426e9fa 100644 --- a/clang/test/SemaCXX/statements.cpp +++ b/clang/test/SemaCXX/statements.cpp @@ -43,8 +43,6 @@ T test7(T v) { return ({ // expected-warning{{use of GNU statement expression extension}} T a = v; a; - ; - ; }); } @@ -53,6 +51,21 @@ void test8() { double b = test7(2.0); } +template <typename T> +T test9(T v) { + return ({ // expected-warning {{use of GNU statement expression extension}} + T a = v; + a; // expected-warning {{expression result unused}} + ; + ; + }); +} + +void test10() { + int a = test9(1); // expected-note {{in instantiation of function template specialization 'test9<int>' requested here}} + // expected-error@-10 {{cannot initialize return object of type 'int' with an rvalue of type 'void'}} +} + namespace GH48405 { void foo() { struct S { |
