<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70899>70899</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
"error : definition with same mangled name" with class NTTP on clang-cl 17.04, but not apple clang 15, or clang 17 in android ndk r26
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
martinbonaciugome
</td>
</tr>
</table>
<pre>
code is quite large, but I get the error:
```
C:\Projects\chimera_client\clientsdk\igl\headers\igl\LinkedList.hpp(212,5): error : definition with same mangled name '??1?$LinkedList@$07@iugo@@QEAA@XZ' as another definition
212 | ~LinkedList()
| ^
C:\Projects\chimera_client\clientsdk\igl\headers\igl\LinkedList.hpp(212,5): note: previous definition is here
C:\Projects\chimera_client\clientsdk\igl\headers\igl\LinkedList.hpp(203,5): error : definition with same mangled name '??0?$LinkedList@$07@iugo@@QEAA@$$QEAU01@@Z' as another definition
203 | LinkedList(LinkedList&& rhs) noexcept
| ^
C:\Projects\chimera_client\clientsdk\igl\headers\igl\LinkedList.hpp(203,5): note: previous definition is here
```
only on windows with clang-cl
code is, but without includes is:
```
namespace iugo
{
template<auto NodeMember>
struct LinkedList;
#pragma mark - LinkedListNode
template<class _T>
struct LinkedListNode
{
using T = RemoveReference<_T>;
using ElementType = Conditional<IsReference<_T>, Ptr<T>, Instance<T>>;
LinkedListNode() noexcept
{
}
LinkedListNode(LinkedListNode const&) = delete;
~LinkedListNode()
{
}
auto& operator =(LinkedListNode const&) = delete;
private:
template<auto> friend struct LinkedList;
union
{
struct
{
Ptr<T> Prev;
ElementType Next;
};
};
#if !FINAL
bool IsConnected = false;
#endif
void Create(Ptr<T> prev) noexcept
{
iglAssert(!IsConnected);
unsafe::Construct(Prev, move(prev));
unsafe::Construct(Next);
#if !FINAL
IsConnected = true;
#endif
}
void Destroy() noexcept
{
iglAssert(IsConnected);
unsafe::Destruct(Next);
unsafe::Destruct(Prev);
#if !FINAL
IsConnected = false;
#endif
}
};
#pragma mark - LinkedList
template<class _T, class T, LinkedListNode<_T> T::* NodeMember>
struct [[clang::trivial_abi]] LinkedList<NodeMember>
{
using ElementType = typename LinkedListNode<_T>::ElementType;
#pragma mark - Node
struct Node: Ptr<T>
{
using Ptr<T>::Ptr;
Node(Ptr<T> rhs) noexcept
: Ptr<T>{move(rhs)}
{
}
using Ptr<T>::operator =;
[[nodiscard]] auto operator ->() const noexcept
{
return &Ptr<T>::operator ->*(NodeMember);
}
};
#pragma mark - Enumerator
template<class TList>
struct [[nodiscard]] Enumerator
{
TList&& List;
Enumerator(TList&& list) noexcept
: List{forward<TList>(list)}
{
}
auto Remove() noexcept requires(!IsConst<RemoveReference<TList>>)
{
#if !FINAL
iglAssert(Version == List.Version(), "Modification during enumeration.");
Version = ++List._Version;
#endif
return List.Remove(Exchange(Current, (Current->*NodeMember).Next));
}
[[nodiscard]] decltype(auto) operator *() const noexcept
{
if constexpr(IsRValueReference<TList>)
{
return move(*Current);
}
else
{
return *Current;
}
}
auto& operator ++()
{
#if !FINAL
iglAssert(Version == List.Version(), "Modification during enumeration.");
#endif
Current = (Current->*NodeMember).Next;
return *this;
}
explicit operator bool() const noexcept
{
return bool(Current);
}
private:
decltype(declval<TList&>().First()) Current = List.First();
#if !FINAL
uint Version = List.Version();
#endif
};
template<class TList>
Enumerator(TList&&) -> Enumerator<TList>;
#pragma mark -
[[nodiscard]] uint Count() const noexcept
{
return _Count;
}
[[nodiscard]] Ptr<T const> First() const noexcept
{
return _Head;
}
[[nodiscard]] Ptr<T> First() noexcept
{
return _Head;
}
[[nodiscard]] Ptr<T const> Last() const noexcept
{
return _Head ? Node{_Head}->Prev : nullptr;
}
[[nodiscard]] Ptr<T> Last() noexcept
{
return _Head ? Node{_Head}->Prev : nullptr;
}
#if !FINAL
[[nodiscard]] uint Version() const noexcept
{
return _Version;
}
#endif
LinkedList() = default;
LinkedList(nullptr_t) noexcept
{
}
template<Enumerable TEnum> requires(!IsSame<Unqualify<TEnum>, LinkedList> && (IsInitializable<T, EnumerableType<TEnum>> || IsConvertible<EnumerableType<TEnum>, ElementType>))
LinkedList(TEnum&& enumerable)
{
for (auto&& item : forward<TEnum>(enumerable))
{
Add(forward<decltype(item)>(item));
}
}
LinkedList(LinkedList&& rhs) noexcept
: _Count{rhs._Count}
, _Head{move(rhs._Head)}
{
#if !FINAL
++rhs._Version;
#endif
rhs._Count = 0;
}
~LinkedList()
{
Destroy(_Head);
}
auto& operator =(nullptr_t) noexcept
{
#if !FINAL
++_Version;
#endif
Destroy(_Head);
_Count = 0;
unsafe::Reconstruct(_Head);
return *this;
}
auto& operator =(LinkedList&& rhs) noexcept
{
iglAssert(this != &rhs);
#if !FINAL
++_Version;
#endif
_Count = rhs._Count;
_Head = move(rhs._Head);
#if !FINAL
++rhs._Version;
#endif
rhs._Count = 0;
return *this;
}
T& Add(ElementType newValue) noexcept
{
auto& value = *newValue;
#if !FINAL
++_Version;
#endif
++_Count;
if (_Head)
{
Node node = _Head;
auto& next = Node{node->Prev}->Next;
next = move(newValue);
Node{next}->Create(Exchange(node->Prev, next));
}
else
{
_Head = move(newValue);
Node{_Head}->Create(_Head);
}
return value;
}
template<class... TArgs> requires IsInitializable<T, TArgs...>
decltype(auto) Add(TArgs&&... args)
{
static_assert(IsSame<ElementType, Instance<T>>);
return Add(New<T>(forward<TArgs>(args)...));
}
[[nodiscard]] ElementType Extract(Node node) noexcept
{
Finally finally = [node] { node->Destroy(); };
#if !FINAL
++_Version;
#endif
--_Count;
if (_Head != node)
{
Node prev = node->Prev;
auto& next = prev->Next;
auto oldValue = Exchange(next, move(node->Next));
Node{next ? next : _Head}->Prev = prev;
return oldValue;
}
else if (node->Next)
{
Node prev = node->Prev;
auto oldValue = Exchange(_Head, move(node->Next));
Node{_Head}->Prev = prev;
return oldValue;
}
else
{
return move(_Head);
}
}
void Remove(Node node) noexcept
{
[[maybe_unused]] ElementType _ = Extract(node);
}
[[nodiscard]] ElementType Pop() noexcept
{
return Extract(_Head->Prev);
}
auto begin()&& noexcept
{
return Enumerator{move(*this)};
}
auto begin() const& noexcept
{
return Enumerator{*this};
}
auto begin()& noexcept
{
return Enumerator{*this};
}
static constexpr auto end() noexcept
{
return Sentinel{};
}
explicit operator bool() const noexcept
{
return bool(_Head);
}
private:
uint _Count = 0;
ElementType _Head;
#if !FINAL
uint _Version = 0;
#endif
void Destroy(Node node) noexcept
{
if (node)
{
Destroy(node->Next);
node->Destroy();
}
}
};
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWltv2zgW_jXMCxFDpnx9yIMtJ9gAnSLTyQwW-xLQ0rHNrUx5KMpN9mF--4IXSZREyfa03S2KWLJ5Ljw3fudINM_ZngM8oOkaTTd3tJCHTDwcqZCMbzNOY1bssyPcbbPk4yHOEsAsx38WTAJOqdgDIhHeFhI_4z1ILA-AQYhMoHCFgg0KVmgW2P_6NlI_TKMXkf0bYpmjaRQf2BEEfYtTBlyqL_RFnnxF04jtUzSNDkATEHl1_4nxr5B8YrkcHU4nRBZkTBCJpogsUbgyCmB1lcCOcSZZxvE3Jg84p0fAR8r3KSSYqxtE5ih8QuHTWH2QSc0aTQJEJsEcTQJlAnU7CX59XK3QJPjnvxCZY5pjyjN5AOEIMtvEGGMyJhjNI3WJ_3L4koXSs1qm_pXL0PTR_vC_sBPPJKjPk4Azy4rcNRfL8QEE_FSnBeH3Oi24xWmITBCZ_Pq4-j0Ymx-u8mIQVu5pONG9mSEyw-KQI7LEPIP3GE7y_-ThhlGv9nArSzOefmBtf55k33LjhzilfH8fp5ZC_7UFoSwCal1WSMx4nBYJ5OqnnkKgHJmfaAxYO8osma9Lq0k4nlKqtI9oITP8OUvgFzhuQaCwtCDOpShi6bolrBjYT8uYhCdB90eKj1R8xfcOiWLsERqnNM_x2-uQNJfUUR3jImd8j18xCjf4CxyzM3yBHQjgsWJtmIad9Y8pHIHL148TaMoo44l2FU1RGD3n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