-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[341] - Did you know that C++26 added user-generated static_assert me…
…ssages?
- Loading branch information
1 parent
d697dd6
commit 4fdf572
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<details open><summary>Info</summary><p> | ||
|
||
* **Did you know that C++26 added user-generated static_assert messages?** | ||
|
||
* https://wg21.link/P2741 | ||
|
||
</p></details><details open><summary>Example</summary><p> | ||
|
||
```cpp | ||
static_assert(false, std::string_view{"message"}); | ||
``` | ||
> https://godbolt.org/z/njoWdn7T7 | ||
</p></details><details open><summary>Puzzle</summary><p> | ||
* **Can you apply format for static_assert messages?** | ||
```cpp | ||
// TODO format | ||
struct foo {}; | ||
static_assert(sizeof(foo) == 0, format("Unexpected sizeof: expected 0, got {}", sizeof(foo))); | ||
``` | ||
|
||
> https://godbolt.org/z/eb4oq14aY | ||
</p></details> |