Search

[Codename Milan]Variadic templates cannot std::forward lambda (C2065&C2974) by gnaka

Closed

1
0
Sign in
to vote
Type: Bug
ID: 775807
Opened: 1/4/2013 8:05:15 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Variadic templates cannot std::forward lambda on Microsoft Visual C++ Compiler Nov 2012 CTP. It produces errors C2065 and C2974.
g++(GCC) 4.8.0 compiles it without any error.
Details (expand)

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

Visual Studio 2012

Steps to reproduce

#include <utility>

#if 1
template <typename ...F>
void catch_functor(F&&... func) {
}

template <typename ...F>
void forward_functor(F&&... func) {
    catch_functor(std::forward<F>(func)...);
}
#else
template <typename F>
void catch_functor(F&& func) {
}

template <typename F>
void forward_functor(F&& func) {
    catch_functor(std::forward<F>(func));
}
#endif

class NamedFunctor {
public:
    void operator()() {    }
};

int
main(){

    forward_functor(NamedFunctor());    // OK
    catch_functor([](){});                // OK
    forward_functor([](){});            // C2065 & C2974

    return 0;
}

Product Language

Japanese

Operating System

Windows Server 2008 R2 SP1

Operating System Language

Any

Actual results

エラー    1    error C2065: '<lambda_9c425b1e5aa0ab594b44e76c30cafe8d>' : undeclared identifier    e:\users\administrator.d2003\documents\visual studio 2012\projects\consoleapplication1\consoleapplication1.cpp    10    1    ConsoleApplication1 (Microsoft Visual C++ Compiler Nov 2012 CTP)
エラー    2    error C2974: 'std::forward' : invalid template argument for '_Ty', type expected    e:\users\administrator.d2003\documents\visual studio 2012\projects\consoleapplication1\consoleapplication1.cpp    10    1    ConsoleApplication1 (Microsoft Visual C++ Compiler Nov 2012 CTP)

Expected results

no error
File Attachments
0 attachments
Sign in to post a comment.
Posted by gnaka on 2/4/2013 at 8:59 PM
I appreciate what you've done for me.
I am looking forawrd to the new release.
Posted by Microsoft on 2/4/2013 at 11:13 AM
Hi:
    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++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 1/6/2013 at 11:52 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 Microsoft on 1/4/2013 at 8: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.