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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to