[LLVMbugs] [Bug 20137] New: explicit instantiation with dll attribute of class template with different dll attribute triggers assert

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 26 11:28:34 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20137

            Bug ID: 20137
           Summary: explicit instantiation with dll attribute of class
                    template with different dll attribute triggers assert
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following code:

  template <typename T> struct __declspec(dllimport) S { T f() { return T(); }
};
  template struct __declspec(dllexport) S<int>;

I think there are two problems here:

We inherit the DLL attribute to the template members once the template
declaration is complete. So S::f gets marked dllimport too early. We might want
to delay running checkDLLAttributes() until instantiation.

When we instantiate S, we merge the dll attributes from the pattern (dllimport)
and the instantiation (dllexport), and end up with S<int> having both
attributes, causing the assert. I think that if the instantiation has an
attribute, that should take precedence.

-- 
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/20140626/61643d7f/attachment.html>


More information about the llvm-bugs mailing list