https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Bug ID: 67898
Summary: rejects-valid on overloaded function as non-type
template argument of dependent type
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Target Milestone: ---
Test case:
void f(int);
void f(float);
template<typename T, T F, T G, bool b = F == G> struct X {};
template<typename T> void test() { X<void(T), f, f>(); }
int main() { test<int>(); }
GCC rejects this valid code saying:
<stdin>:4:51: error: ‘void(T)’ is not a valid type for a template non-type
parameter
<stdin>:4:51: error: ‘void(T)’ is not a valid type for a template non-type
parameter
<stdin>:4:51: error: template argument 4 is invalid
If we work around this bug by changing the code as follows:
template<typename T> void test() { X<void(*)(T), f, f>(); }
... then we get a different rejects-valid:
<stdin>:3:43: error: invalid operands of types ‘<unresolved overloaded
function type>’ and ‘<unresolved overloaded function type>’ to binary
‘operator==’
<stdin>:4:54: error: template argument 4 is invalid