]> gcc.gnu.org Git - gcc.git/commitdiff
testsuite: fix lambda-decltype3.C in C++11
authorMarek Polacek <polacek@redhat.com>
Sat, 11 Nov 2023 00:36:17 +0000 (19:36 -0500)
committerMarek Polacek <polacek@redhat.com>
Sat, 11 Nov 2023 00:36:40 +0000 (19:36 -0500)
This fixes
FAIL: g++.dg/cpp0x/lambda/lambda-decltype3.C  -std=c++11 (test for excess errors)
due to
lambda-decltype3.C:25:6: error: lambda capture initializers only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions]

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/lambda/lambda-decltype3.C: Check __cpp_init_captures.

gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype3.C

index 7fc157aefb58f24df6a0cb45f8aaac64f6218865..2e06e49614088e151d3aa638852ac7afa44caead 100644 (file)
@@ -21,8 +21,10 @@ void f() {
   [=] {
     [](decltype((x)) y) {};     // OK, lambda takes a parameter of type float const&
 
+#if __cpp_init_captures
     [x=1](decltype((x)) y) {
       decltype((x)) z = x;      // OK, y has type int&, z has type int const&
     };
+#endif
   };
 }
This page took 0.121478 seconds and 5 git commands to generate.