r/cpp • #define private public • Feb 24 '26

P4019R0: constant_assert (Jonas Persson)

https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2026/p4019r0.pdf
23 Upvotes

25 comments sorted by

View all comments

Show parent comment

1

u/Nicksaurus Feb 25 '26

If it's an official part of the spec they might make it more reliable. It also doesn't check if the argument is true, it just checks if it's known at compile time

1

u/cd_fr91400 Feb 25 '26

__builtin_constant_p checks if it is known at compile time.

constant_assert checks if it is known true at compile time.

So, constant_assert existence/reliability implies those of __builtin_constant_p.