Home Dashboard Directory Help
Search

seemingly valid dependant types in nested template not accepted by evan.teran


Status: 

Closed
 as Won't Fix Help for as Won't Fix


0
0
Sign in
to vote
Type: Bug
ID: 354162
Opened: 6/29/2008 1:30:08 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

I have encountered a block of code which vc++ rejects but some others compilers accept. When asking other people about the code, none of us can see any reason why it should be rejected. The code in question is:

----snip----

template<int N>
class A {
public:
     typedef int T;

     template<T F1>
     void f();

};

template<int N>
template<typename A<N>::T F1>
void A<N>::f() {

}

int main() {
     A<0> x;
     x.f<1>();
}

----snip----

This produces the following error (obviously replacing "typename A<N>::T" with "int" works, so it seems to be an issue with looking up typedefs in a template type):

1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\users\USER\desktop\test\main.cpp(15) : error C2244: 'A<N>::f' : unable to match function definition to an existing declaration
1>        definition
1>        'void A<N>::f(void)'
1>        existing declarations
1>        'void A<N>::f(void)'
1>Build log was saved at "file://c:\Users\USER\Desktop\Test\Debug\BuildLog.htm"
1>Test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Details
Sign in to post a comment.
Posted by Microsoft on 7/28/2008 at 12:38 PM
Thank you for your feedback!

This is indeed a bug with the compiler. It appears that the compiler is unable to discover the equivalence of the typedef inside and outside of the declaration of A. As you stated, you can directly mention int instead of the typedef in order to workaround this issue. Since this is a conformance issue and there a reasonable workaround this bug does not meet the bar for Dev10. We will, however, re-consider this bug when our compiler front-end overhaul comes online in a future version of Visual Studio.

Peter-Michael Osera
Visual C++ Compiler Team
Posted by Microsoft on 6/30/2008 at 1:47 AM
Thanks for your feedback. We are escalating this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team
Sign in to post a workaround.