Closed jstine35 closed 5 years ago
@robinlavallee
./h/x-simd.h:589:17: error: member ‘float2 float4::<unnamed struct>::xy’ with constructor not allowed in anonymous aggregate
float2 xy,zw;
^~
./h/x-simd.h:589:20: error: member ‘float2 float4::<unnamed struct>::zw’ with constructor not allowed in anonymous aggregate
float2 xy,zw;
^~
Use of the union itself inside another union -- in this particular case -- is a convenience factor, and it could be accomplished other ways. The advantage of this layout is that it mimics gpu pixel/vertex shader syntax and behavior.
This PR is of particular interest! Review the changes I made to
Box2D
. It might look like alien or unfamiliar syntax at first. C++14's implicit type deduction for{}
initializer lists is kind of an amazingly powerful tool.Notes have been added to the unions explaining why they intentionally do not have constructors, and the intention to use C++14's very nifty and incredibly powerful initializer-list syntax in place of the redtape-laden constructors that also break handy union things.
This PR fixes an error which shows up in clang/gcc when you try to nest non-trivial unions inside of other unions. Visual C++ ignores the error even though it's clearly forbidden per C++ Standard Rules.