diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-01-10 22:57:04 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-01-10 22:57:04 +0000 |
commit | a6f6052ac495b7f2b92bcbd88323a977a3163e0e (patch) | |
tree | 783dc4956bd952d3d99f6137db38b9308c64e33f /gcc/cp/parser.c | |
parent | 19cc0dd4ade36a02400c5d89f89efdd3145c0bfb (diff) | |
download | gcc-a6f6052ac495b7f2b92bcbd88323a977a3163e0e.zip gcc-a6f6052ac495b7f2b92bcbd88323a977a3163e0e.tar.gz gcc-a6f6052ac495b7f2b92bcbd88323a977a3163e0e.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7c7d49b..ebd919d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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; |