]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/54442 (Const overloads resolution failure)
authorMarc Glisse <marc.glisse@inria.fr>
Mon, 9 Jun 2014 15:07:24 +0000 (17:07 +0200)
committerMarc Glisse <glisse@gcc.gnu.org>
Mon, 9 Jun 2014 15:07:24 +0000 (15:07 +0000)
2014-06-09  Marc Glisse  <marc.glisse@inria.fr>

PR c++/54442
gcc/
* tree.c (build_qualified_type): Use a canonical type for
TYPE_CANONICAL.
gcc/testsuite/
* g++.dg/pr54442.C: New file.

From-SVN: r211377

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

index b8de64b93c17c1bafb5fd42c13707815752d557f..dd8cd87a49d86090a24166c83f3550e503c09367 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 f3b2c6ab4279ba534944e31055be3e19b1bc2ba7..b3e391a130ccf65904c9827296c5b51bf004d55f 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 9d8e6316c5879c0912c9ab06d095b780e0b52518..7c1dbd59aeb8f5c83725e16347d92b3a92adde39 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;