commit 344d1ea28e060dc539b7f8cbcbeb33a32420f638
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 22 14:39:13 2011 -0400
PR c++/36435
* pt.c (most_specialized_instantiation): Do check return types.
@@ -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;
new file mode 100644
@@ -0,0 +1,6 @@
+// PR c++/36435
+
+template <class T> T f();
+template <class T> T* f() { }
+
+template int* f();