re PR c++/34600 (ICE with invalid use of extern)

/cp
2008-08-14  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/34600
	* g++.dg/parse/crash43.C: New.

From-SVN: r139099
This commit is contained in:
Paolo Carlini 2008-08-14 15:11:01 +00:00 committed by Paolo Carlini
parent 4265559a69
commit 0450a9665e
4 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
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 <manu@gcc.gnu.org>
PR 30551

View File

@ -9270,7 +9270,10 @@ grokdeclarator (const cp_declarator *declarator,
warning (0, "%qs initialized and declared %<extern%>", name);
}
else
error ("%qs has both %<extern%> and initializer", name);
{
error ("%qs has both %<extern%> and initializer", name);
return error_mark_node;
}
}
/* Record `register' declaration for warnings on &

View File

@ -1,3 +1,8 @@
2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/34600
* g++.dg/parse/crash43.C: New.
2008-08-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/28152

View File

@ -0,0 +1,9 @@
// PR c++/34600
namespace N
{
void foo()
{
extern int i = 0; // { dg-error "error: 'i' has both 'extern' and initializer" }
}
}