aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Martin <simartin@users.sourceforge.net>2007-12-10 22:39:27 +0000
committerSimon Martin <simartin@gcc.gnu.org>2007-12-10 22:39:27 +0000
commit0197270c6e3826925ce65bcca780ea218b770bf6 (patch)
tree6f990544e44c80af83a114b925e26b4204950c13
parent1b22c72e3be242e7d47d4d76ebb3d8f3f362045c (diff)
downloadgcc-0197270c6e3826925ce65bcca780ea218b770bf6.zip
gcc-0197270c6e3826925ce65bcca780ea218b770bf6.tar.gz
gcc-0197270c6e3826925ce65bcca780ea218b770bf6.tar.bz2
re PR c++/34059 (ICE with invalid base type for class member)
gcc/cp/ 2007-12-10 Simon Martin <simartin@users.sourceforge.net> PR c++/34059 * typeck.c (build_class_member_access_expr): Compute MEMBER_SCOPE from MEMBER's BASELINK_ACCESS_BINFO instead of its BASELINK_BINFO. gcc/testsuite/ 2007-12-10 Simon Martin <simartin@users.sourceforge.net> PR c++/34059 * g++.dg/parse/crash40.C: New test. From-SVN: r130754
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash40.C42
4 files changed, 54 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 635c697..294be3a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-10 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/34059
+ * typeck.c (build_class_member_access_expr): Compute MEMBER_SCOPE from
+ MEMBER's BASELINK_ACCESS_BINFO instead of its BASELINK_BINFO.
+
2007-12-10 Jakub Jelinek <jakub@redhat.com>
PR c++/34395
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 6a3405a..0f7ecf7 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1800,7 +1800,7 @@ build_class_member_access_expr (tree object, tree member,
warn_deprecated_use (member);
}
else
- member_scope = BINFO_TYPE (BASELINK_BINFO (member));
+ member_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (member));
/* If MEMBER is from an anonymous aggregate, MEMBER_SCOPE will
presently be the anonymous union. Go outwards until we find a
type related to OBJECT_TYPE. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8ff13b4..099f029 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-10 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/34059
+ * g++.dg/parse/crash40.C: New test.
+
2007-12-10 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/memcpy1.C: New test.
diff --git a/gcc/testsuite/g++.dg/parse/crash40.C b/gcc/testsuite/g++.dg/parse/crash40.C
new file mode 100644
index 0000000..af44fdb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash40.C
@@ -0,0 +1,42 @@
+/* PR c++/34059 */
+/* { dg-do "compile" } */
+
+struct A
+{
+ template<int> void foo();
+};
+struct B : A {};
+struct C : A {};
+
+class AA
+{
+ template<int> void foo(); /* { dg-error "is private" } */
+};
+struct BB : AA {};
+
+class AAA {
+ int get() const {}
+};
+struct BBB {
+ static BBB *foo();
+private:
+ int get() const {} /* { dg-error "is private" } */
+};
+template<bool> struct S {
+ S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
+};
+template<bool> struct SS {
+ SS(unsigned int = BBB::foo()->get());
+};
+
+void bar()
+{
+ B().C::foo<0>(); /* { dg-error "is not a member of" } */
+ BB().AA::foo<0>(); /* { dg-error "within this context" } */
+
+ int i;
+ i.C::foo<0>(); /* { dg-error "which is of non-class type" } */
+
+ S<false> s;
+ SS<false> ss; /* { dg-error "within this context" } */
+}