Is the following program well formed?
template<typename T>
void f() { T{}.m; }
using u = decltype(f<int>);
Here's the code to experiment with.
Instantiating f<int> would be wrong, but f<int> is not used in an evaluated context here, so I think it should be ok. clang agrees, however gcc complains with:
In instantiation of 'void f() [with T = int]':
error: request for member 'm' in '0', which is of non-class type 'int'
I don't understand why gcc is instantiating anything here.
So is this code ill formed, or is it a gcc bug?