[llvm-bugs] [Bug 45213] New: clang-cl gives "definition with same mangled name" for lambdas defined as inline const at global scope

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 15 13:10:53 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45213

            Bug ID: 45213
           Summary: clang-cl gives "definition with same mangled name" for
                    lambdas defined as inline const at global scope
           Product: new-bugs
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremy at jeremyms.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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 at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200315/191e8e04/attachment.html>


More information about the llvm-bugs mailing list