This is a re-submission of an older proposed patch (<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" 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>) that Joćo hadn't had time to write tests for (which were requested with the original submission review).<div>
<br></div><div>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><span style="white-space:pre-wrap"><br></span></div><div><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><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">Specifically:</span></div><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">n3376 15.4 [except.spec]/14</span></div>
<div><span style="white-space:pre-wrap"><br></span></div><div><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 fs 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><span style="white-space:pre-wrap"><br></span></div><div><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><span style="white-space:pre-wrap"><br></span></div><div><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><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">struct HasThrowMoveAssign { HasThrowMoveAssign& operator =(const HasThrowMoveAssign&&) throw(POD); };</span></div>
<div><span style="white-space:pre-wrap">struct HasMemberThrowMoveAssign { HasThrowMoveAssign member; };</span></div><div><span style="white-space:pre-wrap"><br></span></div><div><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><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">Also, is it the idea around the no_throw guarantees simply that the invoked methods have empty exception specs? I was under the impression an empty spec didn't necessarily guarantee no-throw semantics, just that any throw that went through that frame would cause std::unexpected to be called.</span></div>
<div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">Unfortunately</span><span style="white-space:pre-wrap"> I can't 'spot check' this vs MSVC 2012 as their __has_nothrow_move_assign seems to return false for everything.</span></div>
<div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">Ryan</span></div>