From 4cbe585c99bf621607420b341384bdb7e0e8a71d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 5 Apr 2018 10:48:40 -0400 Subject: [PATCH] PR c++/85228 - ICE with lambda in enumerator. * pt.c (bt_instantiate_type_proc): Don't assume CLASSTYPE_TEMPLATE_INFO is non-null. From-SVN: r259130 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 1 + gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C | 9 +++++++++ 3 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 37d82bd8c4b..cd3e36323c3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-04-05 Jason Merrill + + PR c++/85228 - ICE with lambda in enumerator in template. + * pt.c (bt_instantiate_type_proc): Don't assume + CLASSTYPE_TEMPLATE_INFO is non-null. + 2018-04-05 Ville Voutilainen Implement P0969 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ed6e62c2364..dc74635876e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22841,6 +22841,7 @@ bt_instantiate_type_proc (binding_entry entry, void *data) tree storage = *(tree *) data; if (MAYBE_CLASS_TYPE_P (entry->type) + && CLASSTYPE_TEMPLATE_INFO (entry->type) && !uses_template_parms (CLASSTYPE_TI_ARGS (entry->type))) do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0); } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C new file mode 100644 index 00000000000..8b0c95b37f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C @@ -0,0 +1,9 @@ +// PR c++/85228 +// { dg-additional-options -std=c++17 } + +template struct A +{ + enum E { e = []{ return 0; }() }; +}; + +template class A<0>; -- 2.30.2