Search

Incorrect parsing of pointer to array return types in trailing return type template functions by No_Unique_Usernames

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 717318
Opened: 1/7/2012 12:43:43 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
Pointer to array returns types are parsed correctly in regular trailing return type functions, but not in template functions. I.e., of the following two functions declarations, the first one compiles correctly but the second one causes error C2059:

auto MyFunc() -> int(*)[4] {
    return nullptr;
};

template<class A>
auto MyFunc2(A* pParam) -> int(*)[4] {
    return nullptr;
};
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

Compile a cpp file that contains the following code:

auto MyFunc() -> int(*)[4] {
    return nullptr;
};

template<class A>
auto MyFunc2(A* pParam) -> int(*)[4] {
    return nullptr;
};

Product Language

English

Operating System

Windows 7

Operating System Language

Any

Actual results

Error C2059 'function-style-cast' occurs on the second function definition (the template function) but not on the first function definition.

Expected results

Both should compile correctly.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/13/2012 at 9:16 AM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by MS-Moderator10 [Feedback Moderator] on 1/8/2012 at 6:06 PM
Thank you for submitting feedback on Visual Studio 2010 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 MS-Moderator01 on 1/7/2012 at 1:44 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.