|
|
| Specialized Template definition order -> no undeclared identifier error |
|
| Author |
Message |
Daniel Segerdahl

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
Hi! Have a look at this code:
// test.h START template<class A> void funcT(A a); void funcF(float a);
template<class A> void funcT(A a) { } void funcF(float a) { funcT(a); } // test.h END
// test.cpp START #include "test.h" int test() { for(int i=0;i<3;i++) i++; return i; } // test.cpp END
When compiling it (VS2005), it gives the error "1>.\test.cpp(6) : error C2065: 'i' : undeclared identifier". This was my intention. But if I switch the funcF and funcT definitions in "test.h" like this:
// test.h START template<class A> void funcT(A a); void funcF(float a);
void funcF(float a) { funcT(a); } template<class A> void funcT(A a) { } // test.h END
When compiling, the C2065 error is gone! How could this be
Best regards Daniel Segerdahl.
Visual C++4
|
| |
|
| |
 |
einaros

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
|
| |
 |
einaros

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
Interestingly, VC6-VC8 all seem to have the same behavior, Comeau reports an error no matter how you arrange it and EDG successfully compiles either way ..
|
| |
|
| |
 |
Daniel Segerdahl

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
Hi! I've looked everywhere now and I can't report the bug. When I click "Submit a Bug or Suggestion" I come to a page which says: "You need permission to submit feedback in this area. To apply for permission, browse through your choices on the Available Connections page.". I have browsed "everywhere" and can't find out how to "apply for permission" for "Visual Studio and .NET Framework".
/Daniel
|
| |
|
| |
 |
Daniel Segerdahl

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
|
| |
 |
Daniel Segerdahl

|
Posted: Visual C++ Language, Specialized Template definition order -> no undeclared identifier error |
Top |
|
| |
 |
| |
|