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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to