Home Dashboard Directory Help

decltype expressions involving polymorphic callable entities fails in VC++11 Beta but works in VC++10 by sharp_kid


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 732063
Opened: 3/19/2012 3:30:39 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
User(s) can reproduce this bug


Writing decltype expressions involving polymorphic callable entities (template function call operator overload) in VC++11 Beta causes the compile-error:

"error C2893: Failed to specialize function template ''unknown-type'..."

But the same decltype expressions compiles and works fine in VC++2010 (and GCC 4.6.2). Code which can reproduce the problem:

template < typename Fn >
struct Foo
    Fn fn;

    template < typename Tp >
    auto operator()(const Tp& x) const -> decltype(fn(x)) { return fn(x); }

struct Bar
    template < typename Tp >
    int operator()(const Tp& x) const { return 0; }

template < typename Fn >
void foobar(Fn f)
    typedef decltype(f(0)) result_type;

int main()
    return 0;
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:24 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 Microsoft on 3/23/2012 at 2:28 PM
Hi: a fix for this issue has been applied to the compiler sources and it should show up in the next release of Visual C++.

Jonathan Caves
Visual C++ Compiler Team
Posted by MS-Moderator07 [Feedback Moderator] on 3/19/2012 at 8:02 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-Moderator01 on 3/19/2012 at 3:45 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.