Base class hides template parameter with the same name. - by Cassio Neri

Status : 

  Deferred<br /><br />
		The product team has reviewed this issue and has deferred it for consideration at a later time.<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 778865 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/8/2013 2:27:18 PM
Access Restriction Public


It's commom for a template classe to derive from one of its parameters. For instance,

ctemplate <typename Base>
struct Foo : public Base {
  Foo() { Base::f(); }

There is an issue when this template is instantiated for a class that has a base with the same name as the template parameter, i.e., Base. In this case, inside Foo's scope the base class hides the template parameter and apparently there's no way to refer to the class used in the instantiation.

The code in the section "Steps to reproduce" show an example. VS 2010, VS2012 and VS CTP Nov 2012 output "Bad" whereas GCC 4.6.3, GCC 4.7.2, GCC 4.8.0, Clang 3.2 and Intel 13.0.1 ouptut "Good". This is a simple example where the code compiles but produces a wrong output. In other variations of this issue the code might fail to compile in Visual Studio.
Sign in to post a comment.
Posted by Cassio Neri on 8/10/2013 at 7:15 AM
This bug is still present in Visual Studio 2013 preview.
Posted by Microsoft on 2/10/2013 at 6:26 PM
Thanks for your feedback.

We are rerouting 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 2/8/2013 at 2:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(