On 3/16/26 4:02 PM, Marek Polacek wrote:
On Mon, Mar 16, 2026 at 03:02:36PM -0400, Jason Merrill wrote:
On 3/16/26 10:40 AM, Marek Polacek wrote:
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
-- >8 --
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
Switch cases in ChangeLogs are generally spelled with [], e.g.
* error.cc (dump_type) [NULLPTR_TYPE]
OK with that change.
Huh. I've always used the <case foo> style and looking at our ChangeLogs
I'm not the only one. Same in binutils-gdb. Even rms's emacs ChangeLog
uses that style:
1998-01-02 Richard Stallman <[email protected]>
* print.c (strout): Take args SIZE and SIZE_BYTE;
operate on both chars and bytes.
(print_string): Pass new arg to strout.
If not using strout, fetch a whole multibyte char at once.
(write_string): Pass new arg to strout.
(write_string_1): Likewise.
(print) <case Lisp_String>: Scan by chars and bytes.
(print) <case Lisp_Symbol>: Scan name by chars and bytes.
I've assumed that [] is for #ifdefs, as documented at
<https://www.gnu.org/prep/standards/html_node/Conditional-Changes.html>.
But <https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html>
says nothing about switch cases. Neither does
<https://gcc.gnu.org/codingconventions.html#ChangeLogs>.
git_commit.py suggests that <case foo> is expected:
# Strip everything that is not a filename in "line":
# entities "(NAME)", cases "<PATTERN>", conditions
# "[COND]", entry text (the colon, if present, and
# anything that follows it).
I can use either but we should state somewhere what the right format is.
Hunh, interesting. I see the [] pattern from other people going back to
ChangeLog-2000; I guess I got it from them rather than the docs.
So, OK without change then.
instead of pp_string.
<case META_TYPE>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/diag6.C: New test.
---
gcc/cp/error.cc | 4 ++--
gcc/testsuite/g++.dg/reflect/diag6.C | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/reflect/diag6.C
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 25e438c1784..f198a1fe065 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -875,11 +875,11 @@ dump_type (cxx_pretty_printer *pp, tree t, int flags)
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:
diff --git a/gcc/testsuite/g++.dg/reflect/diag6.C
b/gcc/testsuite/g++.dg/reflect/diag6.C
new file mode 100644
index 00000000000..61caa082551
--- /dev/null
+++ b/gcc/testsuite/g++.dg/reflect/diag6.C
@@ -0,0 +1,10 @@
+// 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." }
+}
base-commit: 64f95a0eeaf1cb6d07cc414c9b2953a494e03be1
Marek