aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-06-15 16:22:44 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-06-15 16:22:44 -0400
commit582f844c6e30e59ac5641a04cfb7fdd1aff78c66 (patch)
treee8d7988ab646f3a4845371fd779e5edee4b9690b /gcc/testsuite
parent508f1cb51f5872f425a3d4eb3ab8bf5a76a692ac (diff)
downloadgcc-582f844c6e30e59ac5641a04cfb7fdd1aff78c66.zip
gcc-582f844c6e30e59ac5641a04cfb7fdd1aff78c66.tar.gz
gcc-582f844c6e30e59ac5641a04cfb7fdd1aff78c66.tar.bz2
PR c++/82882 - ICE with lambda in template default argument.
* lambda.c (record_null_lambda_scope): New. * pt.c (tsubst_lambda_expr): Use it. * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a function that isn't open. From-SVN: r261654
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg8.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg8.C
new file mode 100644
index 0000000..cf842ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg8.C
@@ -0,0 +1,24 @@
+// PR c++/82282
+// { dg-do compile { target c++14 } }
+
+template<typename = int>
+void f(const char* a =
+ ([](int = []{ static int i; return 42; }()) {
+ static int i;
+ return "";
+ }()));
+
+template<typename = int>
+struct X {
+ void f(const char* a =
+ ([](int = [] { static int i; return 42; }()) {
+ enum { Size = 42 - 1 };
+ return "";
+ }()));
+};
+
+void g()
+{
+ f();
+ X<int>().f();
+}