Commit a6f6052a by Mark Mitchell Committed by Mark Mitchell

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
parent 19cc0dd4
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.
......
......@@ -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;
......
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.
......
struct A { typedef int I; };
int main(void)
{
int * p;
p->A::I::~I();
}
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