Hello: ---------------------------------------------------- template <class A> void foo(const A& a); template <class RET, class ARG1> void foo(RET (&)(ARG1)); float decl(int); void bar(void) { foo(decl); } ---------------------------------------------------- lambda.cc:12: error: call of overloaded 'foo(float (&)(int))' is ambiguous lambda.cc:2: note: candidates are: void foo(const A&) [with A = float ()(int)] lambda.cc:5: note: void foo(RET (&)(ARG1)) [with RET = float, ARG1 = int] I'm pretty sure that the latter overload is more specialized than the former, and EDG agress with me. Not sure if it is a regression.
Bumping priority because it affects Boost.
This is the Boost test which is failing because of this bug: http://boost.sourceforge.net/regression-logs/cs-Linux-links.html#function- lambda_test-gcc-4-experimental-linux
: Search converges between 2004-04-01-trunk (#447) and 2004-04-10-trunk (#448). : Search converges between 2004-06-15-3.4 (#9) and 2004-06-27-3.4 (#10).
(In reply to comment #3) > : Search converges between 2004-04-01-trunk (#447) and 2004-04-10-trunk (#448). > : Search converges between 2004-06-15-3.4 (#9) and 2004-06-27-3.4 (#10). The patches which went between both of those dates (both were by Nathan): PR c++/3518 * pt.c (check_cv_quals_for_unify): Ignore bogus CV quals at outer level. PR c++/14007 * pt.c (check_cv_quals_for_unify): Correct logic for disallowed cv-qualifier unification. * tree.c (cp_build_qualified_type_real): Renable DR295 logic.
so I don't forget to look hard at this one
We don't implement DR214 but edg does. http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#214 I shall see how tricky it is to implement ...
Subject: Bug 19203 CVSROOT: /cvs/gcc Module name: gcc Changes by: nathan@gcc.gnu.org 2005-03-31 17:36:18 Modified files: gcc/cp : ChangeLog call.c cp-tree.h pt.c gcc/testsuite : ChangeLog gcc/testsuite/g++.dg/parse: ambig3.C Added files: gcc/testsuite/g++.dg/template: spec20.C spec21.C Log message: cp: PR c++/19203, implement DR 214 * call.c (joust): Use more_specialized_fn. * cp-tree.h (DEDUCE_ORDER): Remove. (more_specialized): Replace with ... (more_specialized_fn): ... this. * pt.c (maybe_adjust_types_for_deduction): Remove DEDUCE_ORDER case. (type_unification_real): Remove DEDUCE_ORDER case. (more_specialized): Replace with ... (more_specialized_fn): ... this. Implement DR 214. (most_specialized_instantiation): Use get_bindings_real directly. testsuite: PR c++/19203, DR 214 * g++.dg/parse/ambig3.C: Not ambiguous. * g++.dg/template/spec20.C: New. * g++.dg/template/spec21.C: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4681&r2=1.4682 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.532&r2=1.533 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1114&r2=1.1115 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.986&r2=1.987 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5245&r2=1.5246 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/ambig3.C.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec20.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec21.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
2005-03-31 Nathan Sidwell <nathan@codesourcery.com> PR c++/19203, implement DR 214 * call.c (joust): Use more_specialized_fn. * cp-tree.h (DEDUCE_ORDER): Remove. (more_specialized): Replace with ... (more_specialized_fn): ... this. * pt.c (maybe_adjust_types_for_deduction): Remove DEDUCE_ORDER case. (type_unification_real): Remove DEDUCE_ORDER case. (more_specialized): Replace with ... (more_specialized_fn): ... this. Implement DR 214. (most_specialized_instantiation): Use get_bindings_real directly. fixed on mainline. See http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02862.html for comments about 4.0
I've retargeted this patch for GCC 4.0.1. After it's aged on the mainline, we can apply it to the 4.0 branch.
Don't forget to apply the fix for 20723 as well
Flagging it as ambiguous may be correct, but I agree with Nathan that it's wrong :-) Ivan
fixed on 4.0 branch 2005-05-10 Nathan Sidwell <nathan@codesourcery.com> PR c++/20723 * pt.c (more_specialized_fn): Member functions are unordered wrt non-members. Conversion operators are unordered wrt other functions. PR c++/19203, implement DR 214 * call.c (joust): Use more_specialized_fn. * cp-tree.h (DEDUCE_ORDER): Remove. (more_specialized): Replace with ... (more_specialized_fn): ... this. * pt.c (maybe_adjust_types_for_deduction): Remove DEDUCE_ORDER case. (type_unification_real): Remove DEDUCE_ORDER case. (more_specialized): Replace with ... (more_specialized_fn): ... this. Implement DR 214. (most_specialized_instantiation): Use get_bindings_real directly. 2005-05-10 Nathan Sidwell <nathan@codesourcery.com> PR c++/20723 * g++.dg/template/spec22.C: New. * g++.dg/template/spec23.C: New. PR c++/19203, DR 214 * g++.dg/parse/ambig3.C: Not ambiguous. * g++.dg/template/spec20.C: New. * g++.dg/template/spec21.C: New.
Subject: Bug 19203 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: nathan@gcc.gnu.org 2005-05-10 13:48:00 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog call.c cp-tree.h pt.c gcc/testsuite/g++.dg/parse: ambig3.C Added files: gcc/testsuite/g++.dg/template: spec20.C spec21.C spec22.C spec23.C Log message: cp: PR c++/20723 * pt.c (more_specialized_fn): Member functions are unordered wrt non-members. Conversion operators are unordered wrt other functions. PR c++/19203, implement DR 214 * call.c (joust): Use more_specialized_fn. * cp-tree.h (DEDUCE_ORDER): Remove. (more_specialized): Replace with ... (more_specialized_fn): ... this. * pt.c (maybe_adjust_types_for_deduction): Remove DEDUCE_ORDER case. (type_unification_real): Remove DEDUCE_ORDER case. (more_specialized): Replace with ... (more_specialized_fn): ... this. Implement DR 214. (most_specialized_instantiation): Use get_bindings_real directly. testsuite: PR c++/20723 * g++.dg/template/spec22.C: New. * g++.dg/template/spec23.C: New. PR c++/19203, DR 214 * g++.dg/parse/ambig3.C: Not ambiguous. * g++.dg/template/spec20.C: New. * g++.dg/template/spec21.C: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.168&r2=1.5084.2.169 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.38&r2=1.4648.2.39 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.531.2.1&r2=1.531.2.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1106.2.4&r2=1.1106.2.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.978.2.8&r2=1.978.2.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/ambig3.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.84.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec20.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec21.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec22.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec23.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.10.1
Unfortunately, the patch to this PR has caused the regression reported in PR 21799 :-( W.