Search

top-level c/v qualifiers for pointer types confuse linker by Krishty

Closed
as Deferred Help for as Deferred

5
1
Sign in
to vote
Type: Bug
ID: 778487
Opened: 2/4/2013 11:02:37 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
const / volatile on parameters which are passed by-value shouldn't make a difference in C++, but with Visual C++, it does (and causes linker errors).
Details (expand)

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

Visual Studio 2012

Steps to reproduce

// foo.cpp
void foo(int * const) { } // Const!

// main.cpp
void foo(int *); // Non-const!

int main() {
        foo(nullptr);
        return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

error LNK2019: unresolved external symbol "void __cdecl foo(int *)" (?foo@@YAXPAH@Z)

Expected results

successful build

This can be achieved by:
1) re-declaring the function with a non-const parameter in foo.cpp; or
2) changing the parameter type from int * / int * const to int / int const
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/4/2013 at 10:09 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 2/4/2013 at 11: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.