[llvm-bugs] [Bug 41817] New: The linkage changes in r359260 break MIDL code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 9 07:36:19 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190509/7ee58ec5/attachment-0001.html>


More information about the llvm-bugs mailing list