Commit 8d79f003 by Jason Merrill Committed by Jason Merrill

PR c++/84098 - ICE with lambda in template NSDMI.

	* pt.c (instantiate_class_template_1): Ignore more lambdas.

From-SVN: r257199
parent b6019ab1
2018-01-30 Jason Merrill <jason@redhat.com>
PR c++/84098 - ICE with lambda in template NSDMI.
* pt.c (instantiate_class_template_1): Ignore more lambdas.
2018-01-29 Jason Merrill <jason@redhat.com> 2018-01-29 Jason Merrill <jason@redhat.com>
PR c++/68810 - wrong location for reinterpret_cast error. PR c++/68810 - wrong location for reinterpret_cast error.
......
...@@ -10527,6 +10527,11 @@ instantiate_class_template_1 (tree type) ...@@ -10527,6 +10527,11 @@ instantiate_class_template_1 (tree type)
{ {
if (TYPE_P (t)) if (TYPE_P (t))
{ {
if (LAMBDA_TYPE_P (t))
/* A closure type for a lambda in an NSDMI or default argument.
Ignore it; it will be regenerated when needed. */
continue;
/* Build new CLASSTYPE_NESTED_UTDS. */ /* Build new CLASSTYPE_NESTED_UTDS. */
tree newtag; tree newtag;
...@@ -10594,11 +10599,10 @@ instantiate_class_template_1 (tree type) ...@@ -10594,11 +10599,10 @@ instantiate_class_template_1 (tree type)
&& DECL_OMP_DECLARE_REDUCTION_P (r)) && DECL_OMP_DECLARE_REDUCTION_P (r))
cp_check_omp_declare_reduction (r); cp_check_omp_declare_reduction (r);
} }
else if (DECL_CLASS_TEMPLATE_P (t) else if ((DECL_CLASS_TEMPLATE_P (t) || DECL_IMPLICIT_TYPEDEF_P (t))
&& LAMBDA_TYPE_P (TREE_TYPE (t))) && LAMBDA_TYPE_P (TREE_TYPE (t)))
/* A closure type for a lambda in a default argument for a /* A closure type for a lambda in an NSDMI or default argument.
member template. Ignore it; it will be instantiated with Ignore it; it will be regenerated when needed. */;
the default argument. */;
else else
{ {
/* Build new TYPE_FIELDS. */ /* Build new TYPE_FIELDS. */
......
// PR c++/84098
// { dg-options -std=c++17 }
struct A{};
template < typename >
struct Test{
static constexpr auto var = []{};
};
int main(){
(void)Test< A >::var;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment