public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] testsuite: fix lambda-decltype3.C in C++11
@ 2023-11-11  0:38 Marek Polacek
  0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2023-11-11  0:38 UTC (permalink / raw)
  To: GCC Patches

Tested x86_64-pc-linux-gnu, applying to trunk.

-- >8 --
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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype3.C
index 7fc157aefb5..2e06e496140 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype3.C
@@ -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
   };
 }

base-commit: e0c1476d5d7c450b1b16a40364cea4e91237ea93
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-11  0:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-11  0:38 [pushed] testsuite: fix lambda-decltype3.C in C++11 Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).