[llvm-bugs] [Bug 31197] New: [MS] Clang mangles lambdas in member initializers incorrectly

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 28 15:51:22 PST 2016


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

            Bug ID: 31197
           Summary: [MS] Clang mangles lambdas in member initializers
                    incorrectly
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider:

struct A {
  int x = []() { return 1; }();
  int y = []() { return 2; }();
};
int main() {
  A a;
  return a.x + a.y;
}

Clang optimizes this program to return 2 on Windows, because both lambdas use
the mangling context of the expression evaluation contexts of 'x' and 'y'
respectively.

This is underlying cause of the current Windows build failures in
ToolingTest.cpp:

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/846

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xutility(285,3):
 error: definition with same mangled name as another definition
                _Compressed_pair(_One_then_variadic_args_t,
                ^
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xutility(285,3):
 note: previous definition is here
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\INCLUDE\xutility(298,14):  error: definition with same mangled name as
another definition
        const _Ty1& _Get_first() const _NOEXCEPT

-- 
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/20161128/c6cfcb36/attachment.html>


More information about the llvm-bugs mailing list