Forward-declared type and “non-class type as already been declared as a class type” - by Płonąca Żyrafa

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.


2
0
Sign in
to vote
ID 668430 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 5/13/2011 1:47:50 PM
Access Restriction Public

Description

Following code doesn't work:

  template <typename T>
  void foo(struct bar & b);
  struct bar {};
  int main(){}

with error:

  C2990: 'bar' : non-class type as already been declared as a class type

It works without template or with "struct bar;" added before template function declaration.
Sign in to post a comment.
Posted by Microsoft on 5/24/2011 at 5:12 PM
Thank you for reporting this issue. This is indeed a case of non-conformant behaviour in VC++. However, a simple workaround is to reorder the declarations so that the declaration "struct bar" is known when the template declaration is encountered. Due to the low severity of this bug and our priorities, we regret that we cannot fix the bug in the next release of the compiler but we will consider it for a future release.

Regards,

Tanveer Gani
Visual C++ Team
Posted by MS-Moderator07 [Feedback Moderator] on 5/15/2011 at 7:47 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 MS-Moderator07 on 5/15/2011 at 6:25 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/)