Search

[Codename Milan] Specialization fails for variadic function template (C2893) by Vidar Hasfjord

Closed
as Not Reproducible Help for as Not Reproducible

4
0
Sign in
to vote
Type: Bug
ID: 772977
Opened: 11/30/2012 5:36:45 AM
Access Restriction: Public
0
Workaround(s)
2
User(s) can reproduce this bug
Specialization fails for a variadic function template using decltype to deduce its return type.

Workaround: The problem can be circumvented by either (1) eliminating the variadic template or (2) replacing the decltype type specifier by an explicit type. This indicates that the bug is caused by the interaction of these two features.

The code has been tested with GCC 4.7.2, which compiles it without errors.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

#if 1

// This code fails on the Visual C++ Compiler Nov 2012 CTP with the error:
// C2893: Failed to specialize function template 'unknown-type bar(A...)'

int foo (int)
{return 0;}

template <class... A>
auto bar (A... a) -> decltype (foo (a...))
{return foo (a...);}

int main ()
{return bar (1);}

#else

// This works fine, indicating that the origin of the bug is in the
// implementation of variadic templates.

int foo (int)
{return 0;}

auto bar (int a) -> decltype (foo (a))
{return foo (a);}

int main ()
{return bar (1);}

#endif

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

main.cpp(14): error C2893: Failed to specialize function template 'unknown-type bar(A...)'
         With the following template arguments:
         'int'

Expected results

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
File Attachments
0 attachments
Sign in to post a comment.
Posted by Vidar Hasfjord on 2/3/2013 at 9:23 PM
Why has this been closed as "Not Reproducible"? It is indeed reproducible, as is demonstrated by the following code at Rise4Fun, the online test interface for the CTP compiler:

http://rise4fun.com/Vcpp/q8

This is the same code posted in "Details" for this issue.
Posted by Vidar Hasfjord on 12/23/2012 at 4:51 AM
Thank you for the swift response!
Posted by Microsoft on 12/21/2012 at 5:45 PM
Hi Vidar:
    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++.

Visual C++ Team
Posted by Microsoft on 12/2/2012 at 6:06 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 11/30/2012 at 5:51 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)
Sign in to post a workaround.