Search

[Codename Milan] C++11 compilation issue (C2065) by Igor 'arabesc' Pavlov

Closed

1
0
Sign in
to vote
Type: Bug
ID: 772001
Opened: 11/22/2012 5:39:07 PM
Access Restriction: Public
0
Workaround(s)
2
User(s) can reproduce this bug
Microsoft Visual Studio Ultimate 2012
Version 11.0.51020.03 Update 1 CTP

Visual C++ 2012 04940-004-0038003-02800
Microsoft Visual C++ 2012

Visual C++ Compiler November 2012 CTP [Codename Milan] installed.

There is a compilation error of the templated C++ code. Namespace (std) context is lost somewhere during variadic template expansion.
Details (expand)

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

Visual Studio 2012

Steps to reproduce

Compile it:

#include <utility>
#include <string>

namespace foo
{

    // using namespace std; // uncomment to "fix"

    template <typename ...ArgumentTypes>
    void baz(ArgumentTypes... args) {}

    template <typename ...ArgumentTypes>
    struct bar
    {
        bar(ArgumentTypes... args)
        {
            baz(std::forward<ArgumentTypes>(args)...); // error C2065: 'basic_string<char,std::char_traits<char>,std::allocator<char> >' : undeclared identifier
        }
    };

}

int main()
{
    foo::bar<std::string>(std::string("test"));
}

Product Language

English

Operating System

Windows 8

Operating System Language

Any

Actual results

Compiler output:
basic_string<char,std::char_traits<char>,std::allocator<char> >' : undeclared identifier
while compiling class template member function 'foo::bar<std::string>::bar(std::string)'
see reference to function template instantiation 'foo::bar<std::string>::bar(std::string)' being compiled
see reference to class template instantiation 'foo::bar<std::string>' being compiled
error C2974: 'std::forward' : invalid template argument for '_Ty', type expected
c:\program files\microsoft visual studio 11.0\vc\include\type_traits(1780) : see declaration of 'std::forward'
c:\program files\microsoft visual studio 11.0\vc\include\type_traits(1774) : see declaration of 'std::forward'

Expected results

Successful compilation.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 12/28/2012 at 12:26 PM
Hi Igor:
    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 11/23/2012 at 12:44 AM
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 11/22/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.