And add a couple of tests for it.
Notably, this is missing MaterializeTemporaryExpr and ExprWithCleanups, but the basic support seems to work.
Differential D132997
[clang][Interp] Handle DeclRefExpr of reference types tbaeder on Aug 31 2022, 12:29 AM. Authored by
Details And add a couple of tests for it. Notably, this is missing MaterializeTemporaryExpr and ExprWithCleanups, but the basic support seems to work.
Diff Detail Event TimelineComment Actions I think like @aaron.ballman was saying in another PR you should aim for as complete set of tests as possible even if you have to comment one that can't work yet. For example cases that would involve MemberExpr or UsingShadow for example as well as the cases you mentioned not implemented in your description. Comment Actions I get it for the MaterializeTemporaryExprs, but I don't understand why I would add tests using MemberExpr now and not when I work on record types (and references have already landed). Comment Actions The test case I was thinking of for that is: struct S { int i, j; }; constexpr int test() { S s{1, 2}; int &j = s.i; j += 10; return j; } static_assert(test() == 11, ""); where the reference is a DeclRefExpr. Even if structures don't work yet, capturing it as a test case now means we don't have to remember to think about "what if there's a reference to this member" when structures are implemented.
Comment Actions LGTM aside from a request for a comment in the test, thanks!
|