[PATCH] D111400: [Clang] Implement P2242R3

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 12 18:49:51 PST 2022


hubert.reinterpretcast added a comment.

Noting for myself:
Clang's status quo already has behaviours that are similar to P2242R3 in its C++20 mode despite those behaviours being non-conforming and contributing to binary compat breakage with GCC.
This patch is not responsible for those behaviours, and fixing that status quo is not within the scope of this patch.

Shorter test:

  struct NonLit {
    NonLit();
  };
  template <typename T>
  constexpr int foo() {
    return 42;
    T t;
  }
  int (*f())() {
    const int x = foo<NonLit>();
    auto ff = [] { return x; }; // C++20 should error here; x is odr-used and not captured
    return ff;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400



More information about the cfe-commits mailing list