From: Paolo Carlini Date: Thu, 14 Aug 2008 15:11:01 +0000 (+0000) Subject: re PR c++/34600 (ICE with invalid use of extern) X-Git-Tag: releases/gcc-4.4.0~3136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0450a9665e7b06791114a521a20a691e2a1dbf2b;p=thirdparty%2Fgcc.git re PR c++/34600 (ICE with invalid use of extern) /cp 2008-08-14 Paolo Carlini PR c++/34600 * decl.c (grokdeclarator): In case of extern and initializer, return error_mark_node after the error. /testsuite 2008-08-14 Paolo Carlini PR c++/34600 * g++.dg/parse/crash43.C: New. From-SVN: r139099 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e34fb2270a93..48aab06d2453 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-08-14 Paolo Carlini + + PR c++/34600 + * decl.c (grokdeclarator): In case of extern and initializer, return + error_mark_node after the error. + 2008-08-13 Manuel Lopez-Ibanez PR 30551 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3cd251128f1f..b0531604d02d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9270,7 +9270,10 @@ grokdeclarator (const cp_declarator *declarator, warning (0, "%qs initialized and declared %", name); } else - error ("%qs has both % and initializer", name); + { + error ("%qs has both % and initializer", name); + return error_mark_node; + } } /* Record `register' declaration for warnings on & diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdbc3542e9ea..5355b4df23ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-14 Paolo Carlini + + PR c++/34600 + * g++.dg/parse/crash43.C: New. + 2008-08-14 Manuel Lopez-Ibanez PR c/28152 diff --git a/gcc/testsuite/g++.dg/parse/crash43.C b/gcc/testsuite/g++.dg/parse/crash43.C new file mode 100644 index 000000000000..84fe8c5186ca --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash43.C @@ -0,0 +1,9 @@ +// PR c++/34600 + +namespace N +{ + void foo() + { + extern int i = 0; // { dg-error "error: 'i' has both 'extern' and initializer" } + } +}