Search

std::exception_ptr does not satisfy the requirements of NullablePointer by Seth__

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 695529
Opened: 10/18/2011 8:33:48 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
1
Workaround(s)
1
User(s) can reproduce this bug
std::exception_ptr does not support some expressions required by NullablePointer. Specifically:

a != b
a != np
np != a

(a and b denote values of a type (possibly const) that satisfies NullablePointer, and np denotes a value of type (possibly const) std::nullptr_t.)
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

In a C++ project add the code:


    std::exception_ptr a, b;
    a != b;
    a != nullptr;
    nullptr != a;

and observe the results.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Actual result is three compile errors:


error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::exception_ptr' (or there is no acceptable conversion)
error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::exception_ptr' (or there is no acceptable conversion)
error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'nullptr' (or there is no acceptable conversion)

Expected results

Expected behavior is successful compilation and execution.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/4/2011 at 6:48 PM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11.

I carefully compared our exception_ptr implementation to the NullablePointer requirements, and determined that it was also missing boolean testability (e.g. if (p), if (p && stuff)) and swapping. I added them along with the missing op!=() overloads, added a regression test to verify that exception_ptr conforms to NullablePointer's requirements in both syntax and semantics, and additionally improved the performance of comparing exception_ptr to nullptr.

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 MS-Moderator10 [Feedback Moderator] on 10/18/2011 at 8:22 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 10/18/2011 at 8:45 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.
Posted by Seth__ on 10/18/2011 at 8:34 AM
the expressions can be replaced with the negation of an equality test, e.g.

!(a == b)