[PATCH] D154290: [Clang] Implement P2741R3 - user-generated static_assert messages
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 09:51:42 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/test/SemaCXX/static-assert-cxx26.cpp:240
+
+static_assert(false, MessageOverload{}); // expected-error {{static assertion failed: A}}
----------------
Another test case to consider adding:
```
consteval const char *oops() {
const char *ptr; // Garbage
return ptr;
}
static_assert(false, oops()); // This should get the static assertion failure and the invalid message failure
```
(I think this holds because "M.data(), implicitly converted to the type ”pointer to const char”, shall be a core constant expression and let D denote the converted expression," and http://eel.is/c++draft/expr.const#5.8 means this wouldn't qualify as a core constant expression, I believe. At least, that's how non-static assert code behaves: https://godbolt.org/z/aKrfhr9Pj)
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