Search

Visual C++: Ill-Formed unique_ptr Function Call Syntax by Timothy003

Closed
as Fixed Help for as Fixed

0
1
Sign in
to vote
Type: Bug
ID: 633905
Opened: 12/29/2010 11:32:35 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The std::unique_ptr class can be called like a function.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Security

Steps to reproduce

#include <memory>

int main()
{
    std::unique_ptr<int> p;
    p(new int);
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Compiles successfully, IntelliSense reports calling 'void std::default_delete<int>::operator()(int *) const'.

Expected results

Compiler and IntelliSense diagnostic errors.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/27/2011 at 3:09 PM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11. unique_ptr derives from empty deleters in order to take advantage of the Empty Base Class Optimization; we now use private inheritance to prevent the empty deleter's function call operator from being accessible to users of unique_ptr.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 12/30/2010 at 1:20 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 12/29/2010 at 11:35 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.