<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">This is a re-submission of an older proposed patch (</span><a href="http://www.mail-archive.com/cfe-commits@cs.uiuc.edu/msg55616/0001-Added-support-for-MSVC-2012-type-traits-used-in-stan.patch" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank">http://www.mail-archive.com/cfe-commits@cs.uiuc.edu/msg55616/0001-Added-support-for-MSVC-2012-type-traits-used-in-stan.patch</a><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">) that Joćo hadn't had time to write tests for (which were requested with the original submission review).</span><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">The only changes I made from the original (apart from adding tests) was to take out the bail-out for hasTrivialMoveAssignment from <span style="white-space:pre-wrap">UTT_HasNothrowMoveAssign in </span><span style="white-space:pre-wrap">EvaluateUnaryTypeTrait (in lib\Sema\SemaExprCXX.cpp). </span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">My reasoning was that trivial move assignment operators (which I understand to be implicitly generated ones, please correct me if this is mistaken) can actually have non-empty exception specifiers if any of the member move-assignment operators they invoke have such non-empty exception specifiers.</span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">Specifically:</span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div>
<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap">n3376 15.4 [except.spec]/14</span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


<span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap">An inheriting constructor (12.9) and an implicitly declared special member function (Clause 12) have an exception-specification. If f is an inheriting constructor or an implicitly declared default constructor, copy constructor, move constructor, destructor, copy assignment operator, or move assignment operator, its implicit exception-specification specifies the type-id T if and only if T is allowed by the exception-specification of a function directly invoked by f’s implicit definition; f allows all exceptions if any function it directly invokes allows all exceptions, and f has the exception-specification noexcept(true) if every function it directly invokes allows no exceptions. [ Note: An instantiation of an inheriting constructor template has an implied exception-specification as if it were a non-template inheriting constructor.]</span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">so I would expect this class (</span><span style="white-space:pre-wrap">HasMemberThrowMoveAssign</span><span style="white-space:pre-wrap">) to fail for std::is_nothrow_move_assignable:</span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">struct NonPOD { NonPOD(int); };
enum Enum { EV };
struct POD { Enum e; int i; float f; NonPOD* p; };
</span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">struct HasThrowMoveAssign { HasThrowMoveAssign& operator =(const HasThrowMoveAssign&&) throw(POD); };</span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


<span style="white-space:pre-wrap">struct HasMemberThrowMoveAssign { HasThrowMoveAssign member; };</span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap">even though it should have a trivial move-assignment operator generated. </span><span style="white-space:pre-wrap">Please correct me if I am mistaken here as my standards reading FU is...not strong. </span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">I have spot checked this against VS 2012 the best I can, they don't generate implicit move-assign yet so most all the unit tests, run against MSVC 2012 would fail because most of the types in the tests have implicit move-assigns or can't have user defined move assigns (i.e. the scalar types).</span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">It isn't clear if scalar types should be passing is_nothrow_move_assignable, it seems, conceptually, they should trivially pass muster. I tried reading the standard but it isn't entirely clear to me. They talk about move-assignment applying to objects, but then define objects as something with storage, which scalars certainly posses :) If anyone can clarify things like int, enum, pointer to member, and their expected results for is_nothrow_move_assignable I am happy to update any test. Or if you can suggest anything else I missed.</span></div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><span style="white-space:pre-wrap"><br></span></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<span style="white-space:pre-wrap">Ryan</span></div>