https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83258
Bug ID: 83258
Summary: Rejecting function pointer non-type template parameter
without linkage
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Example from StackOverflow (https://stackoverflow.com/q/47606810/2069064):
template<void(*)()> struct A{};
int main()
{
constexpr auto fp = +[]{};
A<fp>{};
}
As of N4268, this should be accepted (linkage is no longer a requirement), but
gcc rejects with:
prog.cc: In function 'int main()':
prog.cc:6:9: error: 'main()::<lambda()>::_FUN' is not a valid template argument
for type 'void (*)()' because 'static constexpr void
main()::<lambda()>::_FUN()' has no linkage
A<fp>{};
^