Consider the following class template:
template<typename T>
struct S
{
template<auto = T()>
void f();
};
Is it ill formed to instantiate S
with template parameters T
, for which auto = T()
is ill formed?
int main()
{
S<int> a; // ok
S<int&> b; // error
S<int()> c; // gcc ok, clang error
}
This seems to be the case, but the issue is with c
, where S
is instantiated with a function type. gcc is ok with this, while clang says:
error: cannot create object of function type 'int ()'
which makes sense. Since gcc does diagnose the instantiation with int&
, I suspect this is a gcc bug. Is that right, or is a diagnostic not required for this code?