<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58197>58197</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libcxxabi] Possibly incorrectly mangled name with conditional templates
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++abi
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Michael137
</td>
</tr>
</table>
<pre>
Found by @var-const when investigating why LLDB fails demangle certain symbols.
Tried on llvm.org top-of-tree as of `9abeb0cbd983c7e32a729e333b033673546e5485` on MacOS
```
namespace std {
namespace ranges {
template <bool>
struct IfImpl {
template <class IfRes>
using Select = IfRes;
};
template <bool Cond, class IfRes>
using If = typename IfImpl<Cond>::template Select<IfRes>;
template <class>
concept AlwaysTrue = true;
template <class T>
using conditional_template = If<AlwaysTrue<T>, int*>;
template<typename T>
struct True {
static const bool value = true;
};
template <class T>
using conditional_template_no_concept = If<True<T>::value, int*>;
} // namespace ranges
template <class T>
std::ranges::conditional_template<T> k() {
return {};
}
} // namespace std
int main() {
std::k<int>();
}
```
With Clang the DWARF linkage name for this is:
`_ZSt1kISt3FooENSt6ranges6IfImplIL_ZNS1_10AlwaysTrueIT_EEEE6SelectIPiEEv`, which `c++filt` isn't able to demangle.
GCC on the other hand detangles this into `_ZSt1kIiENSt6ranges6IfImplIX10AlwaysTrueIT_EEE6SelectIPiEEv`.
```
$ c++filt -n _ZSt1kIiENSt6ranges6IfImplIX10AlwaysTrueIT_EEE6SelectIPiEEv
std::ranges::IfImpl<AlwaysTrue<int> >::Select<int*> std::k<int>()
$ c++filt -n _ZSt1kISt3FooENSt6ranges6IfImplIXL_ZNS1_10AlwaysTrueIT_EEEEE6SelectIPiEEv
_ZSt1kISt3FooENSt6ranges6IfImplIXL_ZNS1_10AlwaysTrueIT_EEEEE6SelectIPiEEv
```
Any idea what the issue here might be?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm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