On 7/22/26 4:44 AM, Jakub Jelinek wrote:
Hi!
We currently print std::nullptr_t or std::meta::info in diagnostics
when seeing a NULLPTR_TYPE or META_TYPE, when they aren't type aliases
(or when they are exactly those type aliases).
I think that isn't a bad idea, the aliases is what users usually
use for those. There are 2 problems with this though.
We print
decltype(nullptr)
and
decltype(nullptr) const volatile
exactly the same, both as std::nullptr_t, so the qualifiers are lost.
And, e.g. in case of a static assertion failure when people want to find
out why some reflections aren't equal we can print
note: the comparison reduces to '(^^std::meta::info == ^^std::meta:info)'
and the user then has no idea what is going on. Is it because one of
those is a type alias (which one), or because of cv-qual differences,
or both?
The following patch prints the aliases in normal %qT etc. printing
only if unqualified, when qualified prints decltype(^^int) or
decltype(nullptr) with the qualifications.
And, when printing a reflection expression, it differentiates even
between the type alias case and non-alias.
So far lightly tested, ok for trunk if it passes full bootstrap/regtest?
Or do you prefer always printing decltype?
In the non-reflection case, we could continue to always print nullptr_t
and info, just add the cv-quals?
Jason