diff options
author | Tom Tromey <tom@tromey.com> | 2024-04-19 20:22:11 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-05-14 13:28:40 -0600 |
commit | a4b7c5f5cda16795dd8be11494e8f1b5de21d69f (patch) | |
tree | 793808a959af265d3e86677a8334aff6f3cd3c98 /gdb/testsuite/gdb.cp | |
parent | Fix C++ canonicalization of hex literals (diff) | |
download | binutils-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.exp | 4 |
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" |