When printing the diagnostics in this test, we're saying
"constexprstd::meta::info dm" which misses a space. We
should use pp_cxx_ws_string which does pp_c_maybe_whitespace
when printing "std::meta::info".
PR c++/124489
gcc/cp/ChangeLog:
* error.cc (dump_type) <case NULLPTR_TYPE>: Use pp_cxx_ws_string
instead of pp_string.
<case META_TYPE>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/diag6.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
break;
case NULLPTR_TYPE:
- pp_string (pp, "std::nullptr_t");
+ pp_cxx_ws_string (pp, "std::nullptr_t");
break;
case META_TYPE:
- pp_string (pp, "std::meta::info");
+ pp_cxx_ws_string (pp, "std::meta::info");
break;
case SPLICE_SCOPE:
--- /dev/null
+// PR c++/124489
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+void
+g ()
+{
+ constexpr decltype(^^::) dm = ^^int; // { dg-message ".constexpr std::meta::info dm. previously declared here" }
+ constexpr decltype(^^::) dm = ^^int; // { dg-error "redeclaration of .constexpr std::meta::info dm." }
+}