From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9944 invoked by alias); 29 May 2012 09:28:28 -0000 Received: (qmail 8718 invoked by uid 22791); 29 May 2012 09:26:47 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 29 May 2012 09:26:35 +0000 From: "adrien at guinet dot me" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52892] Function pointer loses constexpr qualification Date: Tue, 29 May 2012 09:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: adrien at guinet dot me X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg02699.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52892 Adrien Guinet changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |adrien at guinet dot me --- Comment #2 from Adrien Guinet 2012-05-29 09:2= 6:29 UTC --- Hello everyone, Im ay have an issue related to this issue, if that can help: #include struct A { void f(int i) { std::cout << "f " << i << " " << _i << std::endl; } void f2(int i) { std::cout << "f2 " << i << " " << _i << std::endl; } int _i;=20 }; template struct class_f { typedef F f_type; static constexpr f_type f_value =3D f; static constexpr f_type get() { return f; } }; int main() { typedef class_f ff_t; // This does not compile class_f ff;=20 // This does not compile either class_f(&A::f)> ff2; // This does class_f ff_works; } It looks like using a function pointer that has been "instantiated" as an "f_type" makes the compilation fails. here is the output of g++-4.7 with the first "failing" tests : $ g++-4.7 -std=3Dc++0x ftempl.cpp ftempl.cpp: In function =E2=80=98int main()=E2=80=99: ftempl.cpp:24:37: error: could not convert template argument =E2=80=98class= _f::f_value=E2=80=99 to =E2=80=98void (A::*)(int)=E2=80=99 ftempl.cpp:24:41: error: invalid type in declaration before =E2=80=98;=E2= =80=99 token $ g++-4.7 --version g++-4.7 (Debian 4.7.0-8) 4.7.0