Page MenuHomePhabricator

in expression evaluator, treat non-literal types as discarded value expressions if EvalInfo says to continue evaluating them

Authored by nlewycky on Apr 29 2017, 11:08 PM.



Make the integer overflow evaluator continue into expressions with non-literal types, notably void.

In passing it fixes a crash attempting to codegen:

struct A { char x; };
struct B : virtual A {};
A &a = ((A&)*(B*)0);

which we nearly have a test for except that it casted to void and therefore was ignored instead of being evaluated. The existing test (test/SemaCXX/cstyle-cast.cpp) is sufficient to cover this case now that we don't stop at a void cast.

Diff Detail

Event Timeline

nlewycky created this revision.Apr 29 2017, 11:08 PM
rsmith accepted this revision.Apr 30 2017, 6:52 PM

Thanks. Could you also add something like:

struct A {};
struct B : virtual A {};
constexpr A &a = (A&)*(B*)0;

to test/SemaCXX/constant-expression-cxx11.cpp to ensure we produce a suitable diagnostic, please?

This revision is now accepted and ready to land.Apr 30 2017, 6:52 PM