2014-06-09 Marc Glisse <marc.glisse@inria.fr>
authorglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jun 2014 15:07:24 +0000 (15:07 +0000)
committerglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jun 2014 15:07:24 +0000 (15:07 +0000)
PR c++/54442
gcc/
* tree.c (build_qualified_type): Use a canonical type for
TYPE_CANONICAL.
gcc/testsuite/
* g++.dg/pr54442.C: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211377 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b8de64b..dd8cd87 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-09  Marc Glisse  <marc.glisse@inria.fr>
+
+       PR c++/54442
+       * tree.c (build_qualified_type): Use a canonical type for
+       TYPE_CANONICAL.
+
 2014-06-09  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
        * config/arm/arm-modes.def: Remove XFmode.
index f3b2c6a..b3e391a 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-09  Marc Glisse  <marc.glisse@inria.fr>
+
+       PR c++/54442
+       * g++.dg/pr54442.C: New file.
+
 2014-06-09  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/61406
diff --git a/gcc/testsuite/g++.dg/pr54442.C b/gcc/testsuite/g++.dg/pr54442.C
new file mode 100644 (file)
index 0000000..a489565
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+struct S
+{
+  void s (int) const throw ();
+  void s (int) throw ();
+};
+
+typedef int index_t;
+
+void (S::*f) (index_t)       = &S::s;
+void (S::*g) (index_t) const = &S::s;
index 9d8e631..7c1dbd5 100644 (file)
@@ -6326,8 +6326,10 @@ build_qualified_type (tree type, int type_quals)
       else if (TYPE_CANONICAL (type) != type)
        /* Build the underlying canonical type, since it is different
           from TYPE. */
-       TYPE_CANONICAL (t) = build_qualified_type (TYPE_CANONICAL (type),
-                                                  type_quals);
+       {
+         tree c = build_qualified_type (TYPE_CANONICAL (type), type_quals);
+         TYPE_CANONICAL (t) = TYPE_CANONICAL (c);
+       }
       else
        /* T is its own canonical type. */
        TYPE_CANONICAL (t) = t;