Home Dashboard Directory Help
Search

Errors C2950 and C3416 are the same and shouldn't be errors at the first place. by Cassio Neri


Status: 

Closed


1
0
Sign in
to vote
Type: Bug
ID: 753981
Opened: 7/16/2012 4:52:14 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

The errors C2950 and C3416 are, basically, the same:

error C2950: cannot explicitly instantiate an explicit specialization
error C3416: an explicit specialization may not be explicitly instantiated

The only difference is that the former happens with templates classes and the latter with template functions. The code in the "Steps to reproduce section" raises both of them. Nevertheless, this redundancy is not the main issue. Quoting 14.7.2/5:

"For a given set of template parameters, if an explicit instantiation of a template appears after a declaration of an explicit specialization for that template, the explicit instantiation has no effect."

It's worth mentioning that GCC 4.6.3 and Clang 3.1 compile the code with no issue.

I reckon that the issue raised by C2950 and C3416 is important and developers might wanted to be warned abou it. My suggestion is turning the errors into a single (one code and one message) warning. In addition, because the standard says that explicit instantiating a specialization has "no effects", the warning should be turned off by default.
Details
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:32 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Cassio Neri on 8/10/2013 at 6:52 AM
Indeed. It has been fixed in Visual Studio 2013 preview.
Posted by Microsoft on 11/9/2012 at 1:20 PM
Hi Cassio:
    Thanks for reporting the issue.
    I can confirm that this is compiler bug (the errors were added when we fixed several compiler crashes).
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 7/16/2012 at 7:55 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Microsoft Visual Studio Connect Support Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/16/2012 at 5:51 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.