[PATCH] D154290: [Clang] Implement P2741R3 - user-generated static_assert messages

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 10:39:40 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/test/SemaCXX/static-assert-cxx26.cpp:269
+                           //expected-error {{static assertion failed}} \
+                           // expected-note {{in call to 'InvalidPtr{}.data()'}}
----------------
aaron.ballman wrote:
> One more test case to consider: do we properly handle dependent expressions in the assert itself? e.g.,
> ```
> template <typename Ty>
> struct S {
>   static_assert(false, Ty{});
> };
> 
> struct Frobble {
>   constexpr int size() const { return 5; }
>   consterxpr const char *data() const { return "hello"; }
> };
> 
> S<Frobble> s; // Good, fails with "hello"
> S<int> t; // Incorrect
> ```
note that i did split the test in two to better show the appertainance of each diag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154290



More information about the cfe-commits mailing list