Search

[Codename Milan] std::forward ignore namespaces in variadic template functions by Raphael Londeix

Closed
as Fixed Help for as Fixed

2
1
Sign in
to vote
Type: Bug
ID: 775016
Opened: 12/22/2012 6:32:14 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The type name namespaces are totally ignored, and the compiler report that it does not know about the final type name.
Details (expand)

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

Visual Studio 2012

Steps to reproduce

/* compile with cl.exe /EHsc test.cpp */

#include <utility>

namespace foo
{
    struct Bar
    {};
}

template<typename... Args>
void _print(Args&&... args)
{
}

template<typename... Args>
void print(Args&&... args)
{
    _print(std::forward<Args>(args)...);
}

int main()
{
    print(foo::Bar());
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results


> cl /EHsc test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.51025 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

test.cpp
test.cpp(17) : error C2065: 'Bar' : undeclared identifier
        test.cpp(22) : see reference to function template instantiation 'void print<foo::Bar>(foo::Bar &&)' being compiled
test.cpp(17) : error C2974: 'std::forward' : invalid template argument for '_Ty', type expected
        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\type_traits(1780) : see declaration of 'std::forward'
        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\type_traits(1774) : see declaration of 'std::forward'

Expected results

working compilation
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 12/28/2012 at 12:22 PM
Hi Raphael:
    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 12/23/2012 at 9:59 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 12/22/2012 at 6:52 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.