From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20719 invoked by alias); 13 Sep 2011 00:19:50 -0000 Received: (qmail 20700 invoked by uid 22791); 13 Sep 2011 00:19:47 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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, 13 Sep 2011 00:19:32 +0000 From: "luto at mit dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50372] New: c++11: pointers to static functions should be valid template parameters Date: Tue, 13 Sep 2011 03:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: luto at mit dot edu 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: Message-ID: 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: 2011-09/txt/msg00861.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50372 Bug #: 50372 Summary: c++11: pointers to static functions should be valid template parameters Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: luto@mit.edu Created attachment 25253 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D25253 Test case In n3242 [temp.arg.nontype]: A template-argument for a non-type, non-template template-parameter shall be one of: ... - a constant expression (5.19) that designates the address of an object wi= th static storage duration and external or internal linkage or a function with external *or internal* linkage, ... [emphasis added] Nonetheless, the attached test case fails to compile with: foo.cc: In function =E2=80=98void test()=E2=80=99: foo.cc:8:21: error: =E2=80=98static_func=E2=80=99 is not a valid template a= rgument for type =E2=80=98void (*)()=E2=80=99 because function =E2=80=98void static_func()= =E2=80=99 has not external linkage foo.cc:8:21: error: no matching function for call to =E2=80=98foo()=E2=80=99 foo.cc:8:21: note: candidate is: foo.cc:2:6: note: template void foo() foo.cc:2:6: note: substitution of deduced template arguments resulted in errors seen above even with -std=3Dgnu++0x. Tested on 4.6.0 and trunk r178795. AFAICT the error is correct in c++98 mode.