I have a problem with the following code:
template <typename T> void foo(struct bar & b); struct bar {}; int main(){}
It compiles successfully on GCC, but crashes in MSVC (2008) with the following error:
C2990: 'bar' : non-class type as already been declared as a class type
Is the code incorrect or is it an error in MSVC?
It works if I add a struct bar; before defining the template.
source share