diff options
Diffstat (limited to 'absl/debugging/internal/demangle_test.cc')
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 033fefcf..317e8494 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -1148,6 +1148,36 @@ TEST(Demangle, GlobalScopeNewExpression) { EXPECT_STREQ("f<>()", tmp); } +TEST(Demangle, NewExpressionWithEmptyBraces) { + char tmp[80]; + + // Source: + // + // template <class T> decltype(T{*new T{}}) f() { return T{}; } + // template decltype(int{*new int{}}) f<int>(); + // + // GNU demangling: + // + // decltype (int{*(new int{})}) f<int>() + EXPECT_TRUE(Demangle("_Z1fIiEDTtlT_denw_S0_ilEEEv", tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + +TEST(Demangle, NewExpressionWithNonemptyBraces) { + char tmp[80]; + + // Source: + // + // template <class T> decltype(T{*new T{42}}) f() { return T{}; } + // template decltype(int{*new int{42}}) f<int>(); + // + // GNU demangling: + // + // decltype (int{*(new int{42})}) f<int>() + EXPECT_TRUE(Demangle("_Z1fIiEDTtlT_denw_S0_ilLi42EEEEv", tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + TEST(Demangle, SimpleArrayNewExpression) { char tmp[80]; @@ -1212,6 +1242,22 @@ TEST(Demangle, GlobalScopeArrayNewExpression) { EXPECT_STREQ("f<>()", tmp); } +TEST(Demangle, ArrayNewExpressionWithTwoElementsInBraces) { + char tmp[80]; + + // Source: + // + // template <class T> decltype(T{*new T[2]{1, 2}}) f() { return T{}; } + // template decltype(int{*new int[2]{1, 2}}) f<int>(); + // + // GNU demangling: + // + // decltype (int{*(new int{1, 2})}) f<int>() + EXPECT_TRUE(Demangle("_Z1fIiEDTtlT_dena_S0_ilLi1ELi2EEEEv", + tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + TEST(Demangle, ReferenceQualifiedFunctionTypes) { char tmp[80]; |