aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-06-24 12:25:52 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-06-24 12:25:52 -0400
commitc4bcc71fcb21e0543b6ae017bf9381edddfb6316 (patch)
tree6f701bf90cca92cfb681650035c7b8df69c37d44 /gcc/cp/decl.c
parentead1eb1d46252b1f7b31f4cb67c2c6420cd152d4 (diff)
downloadgcc-c4bcc71fcb21e0543b6ae017bf9381edddfb6316.zip
gcc-c4bcc71fcb21e0543b6ae017bf9381edddfb6316.tar.gz
gcc-c4bcc71fcb21e0543b6ae017bf9381edddfb6316.tar.bz2
re PR c++/40342 (ambiguous overload not diagnosed)
PR c++/40342 * decl.c (decls_match): Check DECL_TI_TEMPLATE too. * class.c (resolve_address_of_overloaded_function): Fix typo. From-SVN: r148910
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9ebfd27..02954b5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -916,6 +916,17 @@ decls_match (tree newdecl, tree olddecl)
tree p1 = TYPE_ARG_TYPES (f1);
tree p2 = TYPE_ARG_TYPES (f2);
+ /* Specializations of different templates are different functions
+ even if they have the same type. */
+ tree t1 = (DECL_USE_TEMPLATE (newdecl)
+ ? DECL_TI_TEMPLATE (newdecl)
+ : NULL_TREE);
+ tree t2 = (DECL_USE_TEMPLATE (olddecl)
+ ? DECL_TI_TEMPLATE (olddecl)
+ : NULL_TREE);
+ if (t1 != t2)
+ return 0;
+
if (CP_DECL_CONTEXT (newdecl) != CP_DECL_CONTEXT (olddecl)
&& ! (DECL_EXTERN_C_P (newdecl)
&& DECL_EXTERN_C_P (olddecl)))