Hi,
in this ICE on invalid regression if we don't check the return value of
start_enum we try to use SET_OPAQUE_ENUM_P on an error_mark_node. Tested
x86_64-linux, as usual.
Thanks,
Paolo.
//////////////////////
/cp
2014-01-30 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58649
* pt.c (lookup_template_class_1): Check start_enum return value
for error_mark_node.
/testsuite
2014-01-30 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58649
* g++.dg/template/crash117.C: New.
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 207298)
+++ cp/pt.c (working copy)
@@ -7521,6 +7521,9 @@ lookup_template_class_1 (tree d1, tree arglist, tr
tsubst (ENUM_UNDERLYING_TYPE (template_type),
arglist, complain, in_decl),
SCOPED_ENUM_P (template_type), NULL);
+
+ if (t == error_mark_node)
+ return t;
}
else
{
Index: testsuite/g++.dg/template/crash117.C
===================================================================
--- testsuite/g++.dg/template/crash117.C (revision 0)
+++ testsuite/g++.dg/template/crash117.C (working copy)
@@ -0,0 +1,9 @@
+// PR c++/58649
+
+template<typename> void foo()
+{
+ E(); // { dg-error "declaration|declared" }
+ enum E {};
+}
+
+template void foo<int>();