re PR c++/33601 (ICE with pointers to members using "const C" as the class identifier)
authorDouglas Gregor <doug.gregor@gmail.com>
Fri, 26 Oct 2007 19:34:03 +0000 (19:34 +0000)
committerDoug Gregor <dgregor@gcc.gnu.org>
Fri, 26 Oct 2007 19:34:03 +0000 (19:34 +0000)
2007-10-26  Douglas Gregor  <doug.gregor@gmail.com>

PR c++/33601
* tree.c (build_offset_type): Build canonical type based on the
TYPE_MAIN_VARIANT of the base type.

2007-10-26  Douglas Gregor  <doug.gregor@gmail.com>

* g++.dg/other/pr33601.C: New.

From-SVN: r129659

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/pr33601.C [new file with mode: 0644]
gcc/tree.c

index 626f83e0a2557f4f2e092d20b5c3d3b005cdce8d..6e49d2dd4183ca6ad7980919059313eca591bc34 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-26  Douglas Gregor  <doug.gregor@gmail.com>
+
+       PR c++/33601
+       * tree.c (build_offset_type): Build canonical type based on the
+       TYPE_MAIN_VARIANT of the base type.
+
 2007-10-26  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * reorg.c (emit_delay_sequence): Move insn locator from the
index 02339a0c64faf196d712304c7e17ed1ed4ca7623..4ec601f9113f1e6ad9b790aff72e47596171a812 100644 (file)
@@ -1,3 +1,7 @@
+2007-10-26  Douglas Gregor  <doug.gregor@gmail.com>
+
+       * g++.dg/other/pr33601.C: New.
+
 2007-10-26  Paolo Carlini  <pcarlini@suse.de>
 
        PR c++/31988
diff --git a/gcc/testsuite/g++.dg/other/pr33601.C b/gcc/testsuite/g++.dg/other/pr33601.C
new file mode 100644 (file)
index 0000000..0c17009
--- /dev/null
@@ -0,0 +1,8 @@
+struct A
+{
+  int membervar;
+};
+
+typedef const A type;
+
+int type::* getmemberptr() { return &type::membervar; }
index 88ec29e13e37d287c0574efcd0d8e49e366dbbef..24e758f12cd99449774699d3f0c75bfb97d3a287 100644 (file)
@@ -5949,10 +5949,10 @@ build_offset_type (tree basetype, tree type)
       if (TYPE_STRUCTURAL_EQUALITY_P (basetype)
          || TYPE_STRUCTURAL_EQUALITY_P (type))
        SET_TYPE_STRUCTURAL_EQUALITY (t);
-      else if (TYPE_CANONICAL (basetype) != basetype
+      else if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (basetype)) != basetype
               || TYPE_CANONICAL (type) != type)
        TYPE_CANONICAL (t) 
-         = build_offset_type (TYPE_CANONICAL (basetype), 
+         = build_offset_type (TYPE_CANONICAL (TYPE_MAIN_VARIANT (basetype)),
                               TYPE_CANONICAL (type));
     }