Issue 115403
Summary Clang: __PRETTY_FUNCTION__ does not show enum label
Labels clang
Assignees
Reporter alexolog
    Please see the following code:

<details>
<summary>Code</summary>

	#include <print>
	
	template<typename> struct S1 { enum class E { A }; };
	template<typename> struct S2 { enum class E { A }; };
	using E1 = S1<int>::E;
	using E2 = S2<int>::E;
	
	template <auto v>
	constexpr auto f() noexcept {
	#ifdef _MSC_VER
	    return std::string_view{__FUNCSIG__, sizeof(__FUNCSIG__)};
	#else
	 return std::string_view{__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__)};
	#endif
	}
	
	int main() {
	    std::println("Straight:   {}", f<static_cast<E1>(0)>());
	
	    (void) E2::A; // Now it suddenly works
	    std::println("Workaround: {}", f<static_cast<E2>(0)>());
	}

</details>

<details>
<summary>Results</summary>

Clang:

	Straight: auto f() [v = (S1<int>::E)0]
	Workaround: auto f() [v = S2<int>::E::A]

GCC:

	Straight:   constexpr auto f() [with auto v = S1<int>::E::A]
	Workaround: constexpr auto f() [with auto v = S2<int>::E::A]

MSVC:

	Straight:   auto __cdecl f<S1<int>::E::A>(void) noexcept
	Workaround: auto __cdecl f<S2<int>::E::A>(void) noexcept

</details>

The problem manifests with a scoped enum wrapped in a templated struct.
GCC and MSVC do not exhibit the issue.

This issue interferes with the "Magic enums" library
See https://github.com/Neargye/magic_enum/issues/164
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to