Microsoft VC ++ 2010 gives an error in this code:
template <int D, typename T>
void Foo(T x[D]) {
}
int main() {
float x[3];
Foo(x);
return 0;
}
The same code is passed with gcc and clang.
Is this a bug with VC ++ 2010?
If this is an error:
- Does anyone know if this is fixed in a later version of VC ++?
- Is there a workaround besides an explicit call
Foo<3, float>?
If this is not an error:
Is there a gcc and clang extension that allows them to resolve template arguments?
I greatly simplified the actual code to this small example. I tried this on other compilers, but now I do not have access to newer Microsoft compilers. I found similar questions on SO, but none of them specifically address this case.
source
share