Home Dashboard Directory Help
Search

Using declaration for a name of a type does not work in MS C++ compilers by Michael Kochetkov


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 599151
Opened: 9/16/2010 6:19:14 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Here is the code that demonstrates the problem:
template <class T>
struct A {
    typedef T my_t;
};

template <class T>
struct B : A<T> {
    using typename A<T>::my_t;
    my_t f() { return my_t(); }
};

int
main() {
    B<int> b;
    b.f();
}

I believe it shall compile and link. But it fails.
Details
Sign in to post a comment.
Posted by Microsoft on 11/17/2011 at 8:08 PM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by Michael Kochetkov on 11/3/2011 at 12:57 PM
I have taken a risk to reopen this issue as far as MS claims about the quality and compliance with the standards on its C++ compiler web pages. I just hope you might reconsider and fix this issue as far as it really breaks the portability of C++ code.
Posted by Michael Kochetkov on 10/15/2010 at 4:31 AM
> Fortunately, the using declaration is superflous in this situation so the workaround
> is to eliminate the user declaration.
I believe you are wrong. 14.6.2/3 explicitely forbids to look for unqualified name in a base class scope that depends on a template-parameter. So unfortunately your workaround is the result of another notorious VC behavior that you have for legacy C++ code. And it is not supported by other C++ compilers (we have to have ifdef at such places) and it is not supported by VC itself wit -Za command switch (disable extentions).
Posted by Microsoft on 10/14/2010 at 12:30 PM
Hello Michael,

Thank you for submitting this issue. This would appear to be a valid compiler bug as we should be able to resolve the A::my_t. Fortunately, the using declaration is superflous in this situation so the workaround is to eliminate the user declaration. Due to resource constraints and the priority of this bug, we will not be able to fix it in the next version of Visual Studio.

Thanks,
Mark Roberts
Visual C++ Compiler Team
Posted by Microsoft on 9/16/2010 at 8:10 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by Microsoft on 9/16/2010 at 5:01 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.