aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-04-19 20:22:11 -0600
committerTom Tromey <tom@tromey.com>2024-05-14 13:28:40 -0600
commita4b7c5f5cda16795dd8be11494e8f1b5de21d69f (patch)
tree793808a959af265d3e86677a8334aff6f3cd3c98 /gdb/testsuite/gdb.cp
parentFix C++ canonicalization of hex literals (diff)
downloadbinutils-gdb-a4b7c5f5cda16795dd8be11494e8f1b5de21d69f.tar.gz
binutils-gdb-a4b7c5f5cda16795dd8be11494e8f1b5de21d69f.tar.bz2
binutils-gdb-a4b7c5f5cda16795dd8be11494e8f1b5de21d69f.zip
Implement C++14 numeric separators
C++14 allows the use of the apostrophe as a numeric separator; that is, "23000" and "23'000" represent the same number. This patch implements this for gdb's C++ parser and the C++ name canonicalizer. I did this unconditionally for all C variants because I think it's unambiguous. For the name canonicalizer, there's at least one compiler that can emit constants with this form, see bug 30845. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23457 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30845 Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/misc.exp4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp
index 264294f857d..bcb20f85eee 100644
--- a/gdb/testsuite/gdb.cp/misc.exp
+++ b/gdb/testsuite/gdb.cp/misc.exp
@@ -114,3 +114,7 @@ gdb_test "print *(number_ref + v_bool_array)" "\\$\[0-9\]* = false" \
"integer reference addition with pointer"
gdb_test "print *(v_bool_array - number_ref)" "\\$\[0-9\]* = false" \
"pointer subtraction with integer reference"
+
+# C++14 digit separator.
+gdb_test "print 23'23" " = 2323"
+gdb_test "print 2'3.5" " = 23.5"