This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Fix ignoring CompoundLiteralExprs
ClosedPublic

Authored by tbaeder on May 4 2023, 3:08 AM.

Diff Detail

Event Timeline

tbaeder created this revision.May 4 2023, 3:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2023, 3:08 AM
tbaeder requested review of this revision.May 4 2023, 3:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2023, 3:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder added inline comments.May 4 2023, 3:09 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
537

Obviously, this patch also fixes ignoring InitListExprs.

aaron.ballman added inline comments.May 4 2023, 10:58 AM
clang/test/AST/Interp/literals.cpp
878

Can you also add a test like:

constexpr int oh_my(int x) {
  (int){ x++ };
  return x;
}
static_assert(oh_my(0) == 1);

and

constexpr int oh_my(int x) {
  int y{x++};
  return x;
}

static_assert(oh_my(0) == 1);
tbaeder updated this revision to Diff 520153.May 7 2023, 12:43 AM
tbaeder marked an inline comment as done.
This revision is now accepted and ready to land.May 8 2023, 5:13 AM
This revision was landed with ongoing or failed builds.Aug 1 2023, 2:48 AM
This revision was automatically updated to reflect the committed changes.