Search

Error C2929 should be obsolete by LindleyF

Closed
as Won't Fix Help for as Won't Fix

1
0
Sign in
to vote
Type: Bug
ID: 620017
Opened: 11/8/2010 1:31:21 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Presently, Microsoft's extern template implementation is still warned as an extension, as described in bug ID 559546. The resolution to that bug says it will no longer be marked as a warning in the next version. However, the current implementation does not appear to be fully compatible with the C++0x draft standard.

Error C2929 states that you cannot explicitly instantiate a template in the same translation unit where you marked it as extern. However, the draft standard I have seen states:

"If an entity is the subject of both an explicit instantiation declaration and an explicit instantiation definition in the same translation unit, the definition shall follow the declaration.
An entity that is the subject of an explicit instantiation declaration and that is also used in the translation unit shall be the subject of an explicit instantiation definition somewhere in the program; otherwise the program is ill-formed, no diagnostic required."

This would mean that C2929 should not be an error. Indeed, the fact that C2929 ever existed is curious, since it is contrary to the normal extern concept as it applies to global variables.

This is a significant issue since it greatly complicates the usage of the extern template feature if you either (a) cannot put extern template declarations in header files or (b) must ensure you do not #include the header with the declaration in the source file where those templates are explicitly instantiated.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Compatibility

Steps to reproduce

As described in the C2929 MSDN page.

Product Language

English

Operating System

Windows XP

Operating System Language

English

Actual results

Error C2929

Expected results

Successful compilation
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 12/3/2010 at 1:52 PM
Hello,

As you've noted, our implementation of extern templates does not conform to the C++-0x standard. We still have our old extension implementation. Although we don't have the resources to implement the C++-0x version of this feature for the next release of Visual Studio, conformance issues are a priority for us; we do currently intend to implement this feature in a future version of Visual Studio.

Thanks for taking the time to report this issue. We do appreciate it.

Jamie Eckman
Visual C++ Team
Posted by Microsoft on 11/8/2010 at 7:47 PM
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 Microsoft on 11/8/2010 at 2: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)
Sign in to post a workaround.