public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50372] New: c++11: pointers to static functions should be valid template parameters
@ 2011-09-13 3:13 luto at mit dot edu
2011-11-11 6:07 ` [Bug c++/50372] [C++0x] " jason at gcc dot gnu.org
2011-11-13 10:09 ` jason at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: luto at mit dot edu @ 2011-09-13 3:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50372
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=25253
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 with
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 ‘void test()’:
foo.cc:8:21: error: ‘static_func’ is not a valid template argument for type
‘void (*)()’ because function ‘void static_func()’ has not external linkage
foo.cc:8:21: error: no matching function for call to ‘foo()’
foo.cc:8:21: note: candidate is:
foo.cc:2:6: note: template<void (* fptr)()> void foo()
foo.cc:2:6: note: substitution of deduced template arguments resulted in
errors seen above
even with -std=gnu++0x. Tested on 4.6.0 and trunk r178795.
AFAICT the error is correct in c++98 mode.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/50372] [C++0x] pointers to static functions should be valid template parameters
2011-09-13 3:13 [Bug c++/50372] New: c++11: pointers to static functions should be valid template parameters luto at mit dot edu
@ 2011-11-11 6:07 ` jason at gcc dot gnu.org
2011-11-13 10:09 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-11 6:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50372
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-11 04:29:09 UTC ---
Author: jason
Date: Fri Nov 11 04:29:04 2011
New Revision: 181280
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181280
Log:
PR c++/50372
* pt.c (convert_nontype_argument_function): Allow decls with
internal linkage in C++11.
(convert_nontype_argument): Likewise.
Added:
trunk/gcc/testsuite/g++.dg/template/linkage1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/ext/visibility/anon8.C
trunk/gcc/testsuite/g++.dg/parse/template21.C
trunk/gcc/testsuite/g++.old-deja/g++.other/linkage4.C
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/50372] [C++0x] pointers to static functions should be valid template parameters
2011-09-13 3:13 [Bug c++/50372] New: c++11: pointers to static functions should be valid template parameters luto at mit dot edu
2011-11-11 6:07 ` [Bug c++/50372] [C++0x] " jason at gcc dot gnu.org
@ 2011-11-13 10:09 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-13 10:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50372
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jason at gcc dot gnu.org
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-13 05:54:16 UTC ---
Fixed for 4.7.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-13 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-13 3:13 [Bug c++/50372] New: c++11: pointers to static functions should be valid template parameters luto at mit dot edu
2011-11-11 6:07 ` [Bug c++/50372] [C++0x] " jason at gcc dot gnu.org
2011-11-13 10:09 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).