Compilation error in case of repeating forward declaration within class - by Adam Badura

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 625710 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/30/2010 6:54:41 AM
Access Restriction Public

Description

There is bug in the compiler revealed if a forward declaration of a class is reaped within a different class and that declared class is used in some templates (but in a legal way). The issue was discussed at http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/bd2c2ad4-0377-4aea-b312-2b311ede5191.
Sign in to post a comment.
Posted by Microsoft on 2/7/2011 at 10:42 AM
Hi Adam,
    Thanks for reporting the issue.

    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

    Note that repeating forward declaration within class is not allowed according to C++ standard, 9.2 Class members:

    A member shall not be declared twice in the member-specification, except that a nested class or member class template can be declared and then later defined.

    VC doesn't fully honor the above requirement, and will accept your code. But it is better not to write code like this.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 11/30/2010 at 7:21 AM
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)