https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126343
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:c68a5d17726fe3b57bcea127d21bf71ff53794a3 commit r16-9472-gc68a5d17726fe3b57bcea127d21bf71ff53794a3 Author: Jakub Jelinek <[email protected]> Date: Fri Jul 31 08:37:18 2026 +0200 c++: Improve diagnostics for nullptr_t/info [PR126343] 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, if cv qualified prints qualifications after them (so e.g. 'std::nullptr_t const' or 'std::meta::info volatile'). And, when printing a reflection expression, it differentiates even between the type alias case and non-alias, so for non-aliases prints 'decltype(nullptr)' or 'decltype(^^int) const volatile' etc. 2026-07-31 Jakub Jelinek <[email protected]> PR c++/126343 * error.cc (dump_type) <case NULLPTR_TYPE>: Call pp_c_type_qualifier_list. (dump_type) <case META_TYPE>: Likewise. (dump_expr) <case REFLECT_EXPR>: For REFLECT_EXPR on non-typedef META_TYPE or NULLPTR_TYPE print decltype(^^int) or decltype(nullptr). * g++.dg/reflect/pr126343.C: New test. * g++.dg/reflect/diag6.C: Adjust expected diagnostic wording. * g++.dg/reflect/init2.C: Likewise. * g++.dg/cpp0x/pr124489.C: Likewise. Reviewed-by: Jason Merrill <[email protected]> (cherry picked from commit 525494c18742ef917ef046584af6dd78f713a449)
