From: Paolo Carlini Date: Thu, 30 Jan 2014 14:28:55 +0000 (+0000) Subject: re PR c++/58649 (ICE with use of enum before declaration) X-Git-Tag: releases/gcc-4.9.0~1220 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1b317aecf5cc86d1b61ba07c79fcd93a15a47c5;p=thirdparty%2Fgcc.git re PR c++/58649 (ICE with use of enum before declaration) /cp 2014-01-30 Paolo Carlini PR c++/58649 * pt.c (lookup_template_class_1): Check start_enum return value for error_mark_node. /testsuite 2014-01-30 Paolo Carlini PR c++/58649 * g++.dg/template/crash117.C: New. From-SVN: r207304 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7f9112826262..ff696e3e8848 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-30 Paolo Carlini + + PR c++/58649 + * pt.c (lookup_template_class_1): Check start_enum return value + for error_mark_node. + 2014-01-30 Paolo Carlini * decl.c (duplicate_decls, typename_hash, typename_compare): diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c9c6b379bf6f..4a5b6cc06843 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7521,6 +7521,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, tsubst (ENUM_UNDERLYING_TYPE (template_type), arglist, complain, in_decl), SCOPED_ENUM_P (template_type), NULL); + + if (t == error_mark_node) + return t; } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77953e9b395a..ce37ff181399 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-30 Paolo Carlini + + PR c++/58649 + * g++.dg/template/crash117.C: New. + 2014-01-30 Richard Biener PR c/59905 diff --git a/gcc/testsuite/g++.dg/template/crash117.C b/gcc/testsuite/g++.dg/template/crash117.C new file mode 100644 index 000000000000..5aaaf7344f31 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash117.C @@ -0,0 +1,9 @@ +// PR c++/58649 + +template void foo() +{ + E(); // { dg-error "declaration|declared" } + enum E {}; +} + +template void foo();