aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-01-10 22:57:04 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-01-10 22:57:04 +0000
commita6f6052ac495b7f2b92bcbd88323a977a3163e0e (patch)
tree783dc4956bd952d3d99f6137db38b9308c64e33f /gcc/cp
parent19cc0dd4ade36a02400c5d89f89efdd3145c0bfb (diff)
downloadgcc-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')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c12
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0c73ca2..0764979 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
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;