<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-cl gives "definition with same mangled name" for lambdas defined as inline const at global scope"
href="https://bugs.llvm.org/show_bug.cgi?id=45213">45213</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-cl gives "definition with same mangled name" for lambdas defined as inline const at global scope
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jeremy@jeremyms.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>clang-cl version: 9.0.0 (tags/RELEASE_900/finl)
Target: x86_64-pc-windows-msvc
The following code results in the error:
inline const auto a = [](auto x) { return 0; };
inline const auto b = [](auto x) { return 1; };
int main() { return a(1) + b(1); }
clang_cl_mangling_test.cc(2,23): error: definition with same mangled name
'??$?RH@<lambda_1>@@QEBA?A?<auto>@@H@Z' as another definition
inline const auto b = [](auto x) { return 1; };
^
clang_cl_mangling_test.cc(1,23): note: previous definition is here
inline const auto a = [](auto x) { return 0; };
I have also observed an even worse variant of what I believe to be the same
problem, where compilation is successful but the two different lambdas get
assigned the same symbol and the linker just picks one of them arbitrarily,
leading to incorrect behavior at run time. However, I don't have a short
reproduction of that variant.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>