re PR c++/36435 (Partial ordering of explicit specialization should include return...
authorJason Merrill <jason@redhat.com>
Thu, 23 Jun 2011 16:52:32 +0000 (12:52 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 23 Jun 2011 16:52:32 +0000 (12:52 -0400)
PR c++/36435
* pt.c (most_specialized_instantiation): Do check return types.

From-SVN: r175338

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/partial9.C [new file with mode: 0644]

index 505de351dc545e45cd92be5a4117dd239e0095b8..64a5807260c3d3d8f06b8e3d1fec5cbfe4830790 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/36435
+       * pt.c (most_specialized_instantiation): Do check return types.
+
 2011-06-22  Jason Merrill  <jason@redhat.com>
 
        PR c++/49260
index 2716f7831233d68eebc06395bac6311dfaf1e323..08ce5afc2885326de4dea8ddb22ae0c484b33ca6 100644 (file)
@@ -16610,12 +16610,12 @@ most_specialized_instantiation (tree templates)
 
       if (get_bindings (TREE_VALUE (champ),
                        DECL_TEMPLATE_RESULT (TREE_VALUE (fn)),
-                       NULL_TREE, /*check_ret=*/false))
+                       NULL_TREE, /*check_ret=*/true))
        fate--;
 
       if (get_bindings (TREE_VALUE (fn),
                        DECL_TEMPLATE_RESULT (TREE_VALUE (champ)),
-                       NULL_TREE, /*check_ret=*/false))
+                       NULL_TREE, /*check_ret=*/true))
        fate++;
 
       if (fate == -1)
@@ -16637,10 +16637,10 @@ most_specialized_instantiation (tree templates)
     for (fn = templates; fn != champ; fn = TREE_CHAIN (fn))
       if (get_bindings (TREE_VALUE (champ),
                        DECL_TEMPLATE_RESULT (TREE_VALUE (fn)),
-                       NULL_TREE, /*check_ret=*/false)
+                       NULL_TREE, /*check_ret=*/true)
          || !get_bindings (TREE_VALUE (fn),
                            DECL_TEMPLATE_RESULT (TREE_VALUE (champ)),
-                           NULL_TREE, /*check_ret=*/false))
+                           NULL_TREE, /*check_ret=*/true))
        {
          champ = NULL_TREE;
          break;
index cb31db2e3c8b6073ab7f142e65dd6cc9e614be75..8c1f88650268c084921fe4cb9be9cc1987e2c86d 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/36435
+       * g++.dg/template/partial9.C: New.
+
 2011-06-22  Hans-Peter Nilsson  <hp@axis.com>
 
        PR middle-end/49373
diff --git a/gcc/testsuite/g++.dg/template/partial9.C b/gcc/testsuite/g++.dg/template/partial9.C
new file mode 100644 (file)
index 0000000..4c340fc
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/36435
+
+template <class T> T f();
+template <class T> T* f() { }
+
+template int* f();