Closed roystgnr closed 7 years ago
God dammit C++. Somewhere @knepley is laughing at us. (I was just telling him about Antioch the other day.)
No, wait. C++ doesn't allow that; = initializations allow for "construct temporary then copy construct from it" pessimization but not for "construct default then assign to it" pessimization. I'm actually not sure what's going on now. All I know is that I'm seeing a buffer overflow with lines like const StateType as = a[s];
and changing to const StateType as(a[s]);
somehow fixes it.
This is baffling. I just undid my changes to experiment further, and the test still doesn't fail. "not sure what's going on now" doesnt' begin to describe my confusion.
You'd think that means to construct using
Scalar(bar)
, but the compiler is legally allowed to doScalar()
followed byScalar::operator=(bar)
, and Intel 17 seems to prefer the latter with '-O0' at least. This is a problem when Scalar is valarray, the empty constructor creates an empty array, and the assignment operator is then a buffer overflow.