[PATCH] D124038: [clang] Prevent folding of non-const compound expr

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 09:54:18 PDT 2022


efriedma added a comment.

The `VD->getAnyInitializer()->IgnoreCasts()` is the part that's wrong.  We want to allow something like the following:

  constexpr int *q = (int *)(int[1]){3};
  constexpr int *q2 = q;

To catch the bad cases specifically, we have to wait until we actually reach the compound literal.  See line 4262, or something like that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124038/new/

https://reviews.llvm.org/D124038



More information about the cfe-commits mailing list