VS2010 C++ Compiler fails to compile with error C2146 - gcc 4.3.4 compiles this test OK - by BobConsultant2

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 611628 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/7/2010 6:51:04 PM
Access Restriction Public


The following stand-alone code does not compile in VS2010. 
It compiles in gcc 4.3.4 correctly.
class End {};
class Stuff {public: enum { value = 1234 };};

template<class _Item,class _Tail>
class TypeList
 typedef _Item TItem;
 typedef _Tail TTail;

template<class _Set>
struct YYY
 template<class _Item>
 struct F
 typedef Stuff	Result;
template< template<class _Kind> class _F >
struct XXX
 template<class _Kind>
 struct F
 typedef typename _F<_Kind>			_F_Kind;
 typedef typename _F_Kind::Result		Result;

int main(int argc, char* argv[])
 typedef TypeList<Stuff,End> TMySet;

 typedef XXX<YYY<TMySet>::F>::F<Stuff>::Result	TX;

 if (TX::value != 1234)
 *(char*)0 = 1;

 return 0;
Sign in to post a comment.
Posted by Jamie [MSFT] on 11/12/2010 at 9:52 AM
Hi Bob,

This is indeed a bug in the compiler. However, due to the relatively low priority of the bug, our limited resources, and the fact that there is a workaround available we will be unable to fix this issue for the next release of Visual Studio.

We do appreciate the time you took to open this report. Thank you.

Jamie Eckman
Visual C++ Team
Posted by Microsoft on 10/12/2010 at 1:32 AM
Thanks for your feedback.
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 BobConsultant2 on 10/8/2010 at 9:55 AM
My apologies, I uploaded the version with a workaround to the problem. Change the above code
as follows:


typedef typename _F<_Kind>            _F_Kind;
typedef typename _F_Kind::Result        Result;

typedef typename _F<_Kind>::Result        Result;

and you will get the error.
Posted by Microsoft on 10/8/2010 at 2:52 AM
Sorry for my mistake, there is no attached veido, but after i paste the code to a cpp file in a cpp project and build it, everything goes well.
Posted by Microsoft on 10/8/2010 at 2:41 AM
Thank you for reporting this issue. In order to research the issue reported, we must first reproduce in our labs. Unfortunately, we are unable to reproduce the issue with the steps you provided as the vedio attached shows.

Could you please provide us with a copy of your code file and a vedio shows your reproduce steps?

It would be greatly appreciated if you could provide us this information as quickly as possible.

Thank you,
Posted by Microsoft on 10/7/2010 at 7:23 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)