https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97518

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
A related case I encounter often is:

static_assert( sizeof(T) == 4 );

if the assertion fails I would like to know what the size is, rather than just
"not 4", so I have to add something like Barry's verify_same:

template<size_t> struct undefined;

undefined<sizeof(T)> _;

and read the diagnostics.

If static_assert was able to tell me it failed because 8 == 4 failed, that
would be awesome.

Concepts do help, the diagnostic for std::same_as<T, U> does show the types.
But writing std::same_as<std::integral_constant<std::size_t, sizeof(T)>,
std::integral_constant<std::size_t, 4>> as the assertion just to get sizeof(T)
in the diagnostics is "suboptimal".

Reply via email to