<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115403>115403</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang: __PRETTY_FUNCTION__ does not show enum label
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alexolog
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVsFy4jgQ_Rpx6RrKbuPBPvgABqbmkOxUyM7WnlzCbhvtyBYlyZDs109JJiEkhGQuWLSk956fulvmxoimI8pYPGfxYsR7u1U645IelFTNaKOqx-yHJG4IDBHYLUGtpFQH0TVQqopYNGPBggVPv1FekeVCGhYtn0Omb1u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