[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 11:17:56 PST 2024


================
@@ -463,8 +463,72 @@ void ctor_tests() {
 constexpr SL global_sl = SL::current();
 static_assert(is_equal(global_sl.function(), ""));
 
+template <class T>
+class TestBI {
+public:
+   TestBI() {
+#ifdef MS
+     static_assert(is_equal(__FUNCTION__, "test_func::TestBI<int>::TestBI"));
+     static_assert(is_equal(__func__, "TestBI"));
+#else
+     static_assert(is_equal(__FUNCTION__, "TestBI"));
+     static_assert(is_equal(__func__, "TestBI"));
+#endif
+   }
+};
+
+template <class T>
+class TestClass {
+public:
+   TestClass() {
+#ifdef MS
+      static_assert(is_equal(__FUNCTION__, "test_func::TestClass<class test_func::C>::TestClass"));
----------------
zahiraam wrote:

Yes CL output is: `TestClass<class UnitTestNative>::TestClass`

https://github.com/llvm/llvm-project/pull/84014


More information about the cfe-commits mailing list