From 2a40eb6086cf10d1c3f148db6c5906b0aaa2ff90 Mon Sep 17 00:00:00 2001 From: Chris Mihelich Date: Thu, 6 Jun 2024 13:57:54 -0700 Subject: Demangle C++20 constrained friend names, F ( | ). PiperOrigin-RevId: 641011959 Change-Id: I844d4eb99a9f9da160bb53e491dee753a70750df --- absl/debugging/internal/demangle_test.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'absl/debugging/internal/demangle_test.cc') 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 struct Y { + // friend void y(Y) requires true {} + // }; + // } // namespace ns + // + // y(ns::Y{}); + // + // LLVM demangling: + // + // ns::Y::friend y(ns::Y) 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::friend operator*(ns::Y) requires true + ASSERT_TRUE(Demangle("_ZN2ns1YIiEFdeES1_QLb1E", tmp, sizeof(tmp))); + EXPECT_STREQ(tmp, "ns::Y<>::friend operator*()"); +} + TEST(Demangle, NonTemplateBuiltinType) { char tmp[100]; -- cgit v1.2.3