The example code attached behaves strangely with function types, basically template argument deduction finds cv-qualified reference or pointer to function overloads, rather than the non-cv qualified version. Since cv-qualifiers are illegal on function types this is particular annoying (in fact gcc emits a warning about this). template partial specializations behave in the same way - and this is currently causing a problem for boost's type traits code. Release: gcc-3.2 Environment: Suse Linux 7.0
Responsible-Changed-From-To: unassigned->paolo Responsible-Changed-Why: .
State-Changed-From-To: open->feedback State-Changed-Why: Unfortunately, the example code got lost. Could you possibly send it to me privately? I will complete the PR with it. Thanks, Paolo.
State-Changed-From-To: feedback->open State-Changed-Why: Testcase received.
Responsible-Changed-From-To: paolo->unassigned Responsible-Changed-Why: .
State-Changed-From-To: open->analyzed State-Changed-Why: Current mainline is Ok: paolo:~> a.out non-const non-const non-const On the other hand, 3_2-branch is affected by the bug: paolo:~> a.out const const const Regression from 3.0.4 -> high priority.
From: "John Maddock" <john_maddock@compuserve.com> To: <paolo@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <john_maddock@compuserve.com>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org> Cc: Subject: Re: c++/8503: strange behaviour of function types. Date: Sat, 9 Nov 2002 11:20:17 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C287E1.FB7F23C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > Unfortunately, the example code got lost. > Could you possibly send it to me privately? I will complete > the PR with it. > Thanks, Paolo. See attached. ------=_NextPart_000_0026_01C287E1.FB7F23C0 Content-Type: application/octet-stream; name="Gcc_bug.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Gcc_bug.cpp" #include <iostream> template <class T> struct is_const { static void check() { std::cout << "non-const\n"; } }; template <class T> struct is_const<T const> { static void check() { std::cout << "const\n"; } }; template <class T> void overload_reference(T&) {std::cout << "non-const\n"; } template <class T> void overload_reference(const volatile T&) {std::cout << "const\n"; } template <class T> void overload_pointer(T*) {std::cout << "non-const\n"; } template <class T> void overload_pointer(const volatile T*) {std::cout << "const\n"; } int sample_proc(int) { return 0; } int main() { typedef int (foo_type)(int); is_const<foo_type>::check(); foo_type& f = sample_proc; overload_reference(f); foo_type* pf = &f; overload_pointer(pf); } ------=_NextPart_000_0026_01C287E1.FB7F23C0--
Responsible-Changed-From-To: unassigned->lerdsuwa Responsible-Changed-Why: Will look at it.
Responsible-Changed-From-To: lerdsuwa->nathan Responsible-Changed-Why: Hi Nathan, Awhile back you fixed a bug related to DR 295 implementation on the main trunk with relevant ChangeLog entry below: 2002-09-16 Nathan Sidwell <nathan@codesourcery.com> Remove DR 295 implementation. * pt.c (check_cv_quals_for_unify): Disable function & method cases. * tree.c (cp_build_qualified_type_real): Likewise. Don't warn about ignoring volatile qualifiers. However the bug is still present in the 3.2 branch and there are two GNATS report about the problem: PR8503 and PR7774. I've verified that the patch fixes these bugs. Would you consider applying it for the 3.2 branch as well? --Kriang
State-Changed-From-To: analyzed->closed State-Changed-Why: 2002-12-26 Nathan Sidwell <nathan@codesourcery.com> PR c++/8503 Remove DR 295 implementation. * pt.c (check_cv_quals_for_unify): Disable function & method cases. * tree.c (cp_build_qualified_type_real): Likewise. Don't warn about ignoring volatile qualifiers.
From: nathan@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8503 Date: 26 Dec 2002 12:58:07 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_2-branch Changes by: nathan@gcc.gnu.org 2002-12-26 04:58:07 Modified files: gcc/cp : ChangeLog pt.c tree.c gcc/testsuite : ChangeLog gcc/testsuite/g++.dg/template: qualttp20.C gcc/testsuite/g++.old-deja/g++.jason: report.C gcc/testsuite/g++.old-deja/g++.other: qual1.C Log message: cp: PR c++/8503 Remove DR 295 implementation. * pt.c (check_cv_quals_for_unify): Disable function & method cases. * tree.c (cp_build_qualified_type_real): Likewise. Don't warn about ignoring volatile qualifiers. testsuite: * g++.dg/template/qualttp20.C: Adjust expected errors. * g++.old-deja/g++.jason/report.C: Likewise. * g++.old-deja/g++.other/qual1.C: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.56&r2=1.2685.2.114.2.57 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.578.2.11.2.8&r2=1.578.2.11.2.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.268.2.7.2.3&r2=1.268.2.7.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.76&r2=1.1672.2.166.2.77 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/qualttp20.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1&r2=1.1.12.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.jason/report.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.7.2.1&r2=1.7.2.1.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/qual1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.3&r2=1.3.10.1