Commit cc328145 by Mark Mitchell Committed by Mark Mitchell

re PR c++/27102 (ICE with invalid class name in function template)

	PR c++/27102
	* decl.c (grokdeclarator): Robustify checks for defining members
	of incomplete types.
	PR c++/27102
	* g++.dg/template/crash49.C: New test.

From-SVN: r113492
parent db40f6d4
2006-05-02 Mark Mitchell <mark@codesourcery.com> 2006-05-02 Mark Mitchell <mark@codesourcery.com>
PR c++/27102
* decl.c (grokdeclarator): Robustify checks for defining members
of incomplete types.
PR c++/27309 PR c++/27309
* class.c (add_method): Call grok_special_member_properties. * class.c (add_method): Call grok_special_member_properties.
* decl.c (grokdeclarator): Don't call it here. * decl.c (grokdeclarator): Don't call it here.
......
...@@ -7722,12 +7722,19 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7722,12 +7722,19 @@ grokdeclarator (const cp_declarator *declarator,
else if (/* If the qualifying type is already complete, then we else if (/* If the qualifying type is already complete, then we
can skip the following checks. */ can skip the following checks. */
!COMPLETE_TYPE_P (ctype) !COMPLETE_TYPE_P (ctype)
/* If a function is being defined, then the qualifying && (/* If the function is being defined, then
type must be complete. The qualifying type may be qualifying type must certainly be complete. */
incomplete for a declaration only if the qualifying funcdef_flag
type is one of the classes presently being defined, /* A friend declaration of "T::f" is OK, even if
or if it is a dependent type. */ "T" is a template parameter. But, if this
&& (funcdef_flag function is not a friend, the qualifying type
must be a class. */
|| (!friendp && !CLASS_TYPE_P (ctype))
/* For a declaration, the type need not be
complete, if either it is dependent (since there
is no meaningful definition of complete in that
case) or the qualifying class is currently being
defined. */
|| !(dependent_type_p (ctype) || !(dependent_type_p (ctype)
|| currently_open_class (ctype))) || currently_open_class (ctype)))
/* Check that the qualifying type is complete. */ /* Check that the qualifying type is complete. */
......
2006-05-02 Mark Mitchell <mark@codesourcery.com>
PR c++/27102
* g++.dg/template/crash49.C: New test.
2006-05-02 Steve Ellcey <sje@cup.hp.com> 2006-05-02 Steve Ellcey <sje@cup.hp.com>
PR testsuite/27032 PR testsuite/27032
// PR c++/27102
template <typename T>
void T::foo; // { dg-error "invalid" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment