]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/34059 (ICE with invalid base type for class member)
authorSimon Martin <simartin@users.sourceforge.net>
Mon, 10 Dec 2007 22:54:26 +0000 (22:54 +0000)
committerSimon Martin <simartin@gcc.gnu.org>
Mon, 10 Dec 2007 22:54:26 +0000 (22:54 +0000)
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: r130756

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash40.C [new file with mode: 0644]

index d42dfe0c3d7fd9acb254c7fae009c70765a72737..08525af70462671571afabec548907708be7fa7d 100644 (file)
@@ -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-10-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/33744
index c98775eeff872f8f3130dda74123ceaf5803b01b..9e8ca6eabe14125c53699c876f64e61e06dc5ffd 100644 (file)
@@ -1795,7 +1795,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.  */
index 1be5494c0247aed4683c4cce34b17e913262c4f2..f8a31aae8a933e6412051d864852d5b42f380399 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-10  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/34059
+       * g++.dg/parse/crash40.C: New test.
+
 2007-11-28  Rask Ingemann Lambertsen  <rask@sygehus.dk>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/parse/crash40.C b/gcc/testsuite/g++.dg/parse/crash40.C
new file mode 100644 (file)
index 0000000..af44fdb
--- /dev/null
@@ -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" } */
+}