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

            Bug ID: 41817
           Summary: The linkage changes in r359260 break MIDL code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: dma...@mozilla.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

The following code builds successfully with r359259 but not r359260:

$ cat a.cpp
extern const int x;
static const int x = 3;
const int* foo() { return &x; }

$ cat b.cpp
extern const int x;
static const int x = 7;
const int* bar() { return &x; }

$ cat c.cpp
const int* foo();
const int* bar();
int main(int argc, char**) { return argc ? *foo() : *bar(); }

$ clang-cl -c a.cpp b.cpp c.cpp

$ lld-link -nodefaultlib -entry:main a.obj b.obj c.obj
lld-link: error: duplicate symbol: int const x in a.obj and in b.obj

This pattern can be seen in code generated by MIDL, e.g.
https://searchfox.org/mozilla-central/search?q=text%3AHandlerData__MIDL_ProcFormatString

Since there are no templates involved here, I'm guessing this change in
behavior was unintended?

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

Reply via email to