diff options
author | Chris Mihelich <cmihelic@google.com> | 2024-06-06 13:57:54 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-06-06 13:58:39 -0700 |
commit | 2a40eb6086cf10d1c3f148db6c5906b0aaa2ff90 (patch) | |
tree | 60295a9f29640656dfc6ce864590603b55418da6 /absl/debugging/internal/demangle_test.cc | |
parent | 0cd50e6ee37f1bd8be8dd716694470a7f20b6a59 (diff) |
Demangle C++20 constrained friend names, F (<source-name> | <operator-name>).
PiperOrigin-RevId: 641011959
Change-Id: I844d4eb99a9f9da160bb53e491dee753a70750df
Diffstat (limited to 'absl/debugging/internal/demangle_test.cc')
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 1d108c8b..68ab8a3c 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -160,6 +160,34 @@ TEST(Demangle, ConstrainedAutoInFunctionTemplate) { EXPECT_STREQ(tmp, "f<>()"); } +TEST(Demangle, ConstrainedFriendFunctionTemplate) { + char tmp[100]; + + // Source: + // + // namespace ns { + // template <class T> struct Y { + // friend void y(Y) requires true {} + // }; + // } // namespace ns + // + // y(ns::Y<int>{}); + // + // LLVM demangling: + // + // ns::Y<int>::friend y(ns::Y<int>) requires true + ASSERT_TRUE(Demangle("_ZN2ns1YIiEF1yES1_QLb1E", tmp, sizeof(tmp))); + EXPECT_STREQ(tmp, "ns::Y<>::friend y()"); +} + +TEST(Demangle, ConstrainedFriendOperatorTemplate) { + char tmp[100]; + + // ns::Y<int>::friend operator*(ns::Y<int>) requires true + ASSERT_TRUE(Demangle("_ZN2ns1YIiEFdeES1_QLb1E", tmp, sizeof(tmp))); + EXPECT_STREQ(tmp, "ns::Y<>::friend operator*()"); +} + TEST(Demangle, NonTemplateBuiltinType) { char tmp[100]; |