The code
template <typename T>
struct Foo
{
int x_;
int x() const;
};
int a;
template <typename T>
decltype(a) Foo<T>::x() const
{
return x_;
}
int main()
{
}
produces the following error in Visual Studio 2013:
1>...\source.cpp(15): error C2244: 'Foo<T>::x' : unable to match function
definition to an existing declaration
1> ...\source.cpp(6) : see declaration of 'Foo<T>::x'
1> definition
1> 'unknown-type Foo<T>::x(void) const'
1> existing declarations
1> 'int Foo<T>::x(void) const'
but compiles fine on Coliru's GCC. Also, it compiles in VS as a non-template class. I guess this is due to Visual Studio's incompleteness and if it is indeed, I'm sure the cause of this already has its name. I just can't find it with my sloppy terminology. What's going on?