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: r148911
This commit is contained in:
parent
61b744bf33
commit
4366506b5d
|
@ -1,3 +1,9 @@
|
|||
2009-06-24 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/40342
|
||||
* decl.c (decls_match): Check DECL_TI_TEMPLATE too.
|
||||
* class.c (resolve_address_of_overloaded_function): Fix typo.
|
||||
|
||||
2009-06-09 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/40381
|
||||
|
|
|
@ -6158,7 +6158,7 @@ resolve_address_of_overloaded_function (tree target_type,
|
|||
|
||||
fn = TREE_PURPOSE (matches);
|
||||
for (match = TREE_CHAIN (matches); match; match = TREE_CHAIN (match))
|
||||
if (!decls_match (fn, TREE_PURPOSE (matches)))
|
||||
if (!decls_match (fn, TREE_PURPOSE (match)))
|
||||
break;
|
||||
|
||||
if (match)
|
||||
|
|
|
@ -929,6 +929,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)))
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-06-24 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/40342
|
||||
* g++.dg/template/overload10.C: New.
|
||||
|
||||
2009-06-22 Matthias Klose <doko@ubuntu.com>
|
||||
|
||||
PR objc/28050
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// PR c++40342
|
||||
|
||||
template <typename T1, typename T2> int f(T1 *, const T2 *); // { dg-error "" }
|
||||
template <typename T1, typename T2> int f(const T1 *, T2 *); // { dg-error "" }
|
||||
|
||||
int (*p)(const int *, const int *) = f; // { dg-error "ambiguous" }
|
Loading…
Reference in New Issue