summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
Diffstat (limited to 'absl')
-rw-r--r--absl/debugging/internal/demangle.cc11
-rw-r--r--absl/debugging/internal/demangle_test.cc19
2 files changed, 28 insertions, 2 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc
index 6507afb5..184d89fb 100644
--- a/absl/debugging/internal/demangle.cc
+++ b/absl/debugging/internal/demangle.cc
@@ -2476,8 +2476,15 @@ static bool ParseExprCastValueAndTrailingE(State *state) {
}
state->parse_state = copy;
- if (ParseFloatNumber(state) && ParseOneCharToken(state, 'E')) {
- return true;
+ if (ParseFloatNumber(state)) {
+ // <float> for ordinary floating-point types
+ if (ParseOneCharToken(state, 'E')) return true;
+
+ // <float> _ <float> for complex floating-point types
+ if (ParseOneCharToken(state, '_') && ParseFloatNumber(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
}
state->parse_state = copy;
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc
index 9100d5f1..111e895c 100644
--- a/absl/debugging/internal/demangle_test.cc
+++ b/absl/debugging/internal/demangle_test.cc
@@ -641,6 +641,25 @@ TEST(Demangle, StringLiterals) {
EXPECT_STREQ("f<>()", tmp);
}
+TEST(Demangle, ComplexFloatingPointLiterals) {
+ char tmp[80];
+
+ // Source (use g++ -fext-numeric-literals to compile):
+ //
+ // using C = double _Complex;
+ // template <class T> void f(char (&)[sizeof(C{sizeof(T)} + 4.0j)]) {}
+ // template void f<int>(char (&)[sizeof(C{sizeof(int)} + 4.0j)]);
+ //
+ // GNU demangling:
+ //
+ // void f<int>(char (&) [sizeof (double _Complex{sizeof (int)}+
+ // ((double _Complex)0000000000000000_4010000000000000))])
+ EXPECT_TRUE(Demangle(
+ "_Z1fIiEvRAszpltlCdstT_ELS0_0000000000000000_4010000000000000E_c",
+ tmp, sizeof(tmp)));
+ EXPECT_STREQ("f<>()", tmp);
+}
+
TEST(Demangle, GlobalInitializers) {
char tmp[80];