re PR c++/30659 (ICE in undefined template)

cp/
2007-10-28  Paolo Carlini  <pcarlini@suse.de>
	    Mark Mitchell  <mark@codesourcery.com>

	PR c++/30659
	* pt.c (do_decl_instantiation): If the VAR_DECL is not a
	class member error out and return.

testsuite/
2007-10-28  Paolo Carlini  <pcarlini@suse.de>
	    Mark Mitchell  <mark@codesourcery.com>

	PR c++/30659
	* g++.dg/template/crash71.C: New.

Co-Authored-By: Mark Mitchell <mark@codesourcery.com>

From-SVN: r129710
This commit is contained in:
Paolo Carlini 2007-10-29 00:17:10 +00:00 committed by Paolo Carlini
parent a9077d27da
commit 8259e4f5bd
4 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2007-10-28 Paolo Carlini <pcarlini@suse.de>
Mark Mitchell <mark@codesourcery.com>
PR c++/30659
* pt.c (do_decl_instantiation): If the VAR_DECL is not a
class member error out and return.
2007-10-27 Jakub Jelinek <jakub@redhat.com>
* error.c (reinit_cxx_pp): Initialize cxx_pp->enclosing_scope

View File

@ -13882,6 +13882,11 @@ do_decl_instantiation (tree decl, tree storage)
VAR_DECLs so we do the lookup here. Probably, grokdeclarator
should handle VAR_DECLs as it currently handles
FUNCTION_DECLs. */
if (!DECL_CLASS_SCOPE_P (decl))
{
error ("%qD is not a static data member of a class template", decl);
return;
}
result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, false);
if (!result || TREE_CODE (result) != VAR_DECL)
{

View File

@ -1,3 +1,9 @@
2007-10-28 Paolo Carlini <pcarlini@suse.de>
Mark Mitchell <mark@codesourcery.com>
PR c++/30659
* g++.dg/template/crash71.C: New.
2007-10-28 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/32147

View File

@ -0,0 +1,3 @@
// PR c++/30659
extern "C" template A<char> foo(); // { dg-error "forbids|static data|expected" }