re PR c++/9120 (miscompilation of function with references to undeclared objects and functions)

PR c++/9120
	* parser.c (cp_parser_scope_through_which_access_occurs): Handle
	an object_type which is not a class type.

	PR c++/9120
	* g++.dg/parse/dtor1.C: New file.

From-SVN: r61174
This commit is contained in:
Mark Mitchell 2003-01-10 22:57:04 +00:00 committed by Mark Mitchell
parent 19cc0dd4ad
commit a6f6052ac4
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-01-10 Mark Mitchell <mark@codesourcery.com>
PR c++/9120
* parser.c (cp_parser_scope_through_which_access_occurs): Handle
an object_type which is not a class type.
2003-01-10 Geoffrey Keating <geoffk@apple.com>
* parser.c (cp_parser_late_parsing_for_member): Don't cast to void.

View File

@ -2230,7 +2230,17 @@ cp_parser_scope_through_which_access_occurs (decl,
if (!TYPE_P (scope))
return NULL_TREE;
/* Figure out the type through which DECL is being accessed. */
if (object_type && DERIVED_FROM_P (scope, object_type))
if (object_type
/* OBJECT_TYPE might not be a class type; consider:
class A { typedef int I; };
I *p;
p->A::I::~I();
In this case, we will have "A::I" as the DECL, but "I" as the
OBJECT_TYPE. */
&& CLASS_TYPE_P (object_type)
&& DERIVED_FROM_P (scope, object_type))
/* If we are processing a `->' or `.' expression, use the type of the
left-hand side. */
qualifying_type = object_type;

View File

@ -1,5 +1,8 @@
2003-01-10 Mark Mitchell <mark@codesourcery.com>
PR c++/9120
* g++.dg/parse/dtor1.C: New file.
PR c++/9128
* g++.dg/rtti/typeid1.C: New file.

View File

@ -0,0 +1,6 @@
struct A { typedef int I; };
int main(void)
{
int * p;
p->A::I::~I();
}