[LLVMbugs] [Bug 20725] New: Clang fails to propagate dll attribute to already specialized template bases

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 21 10:37:37 PDT 2014


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

            Bug ID: 20725
           Summary: Clang fails to propagate dll attribute to already
                    specialized template bases
           Product: clang
           Version: unspecified
          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 example:

  template <typename T> struct Template {};

  template<> struct Template<int> { int foo() { return 42; } };

  struct __declspec(dllexport) S : public Template<int> { };

  int f(S s) {
    return s.foo();
  }

MSVC will export Template<int>::foo() here, because the dllexport attribute
from S gets propagated to the base class.

Clang currently fails with a warning:

  d:\src\tmp\a.cc(5,41) :  warning: propagating dll attribute to explicitly
        specialized base class template without dll attribute is not supported
        [-Wunsupported-dll-base-class-template]
  struct __declspec(dllexport) S : public Template<int> { };
                                          ^
  d:\src\tmp\a.cc(5,19) :  note: attribute is here
  struct __declspec(dllexport) S : public Template<int> { };
                    ^
  d:\src\tmp\a.cc(3,19) :  note: class template 'Template<int>' was explicitly
        specialized here
  template<> struct Template<int> { int foo() { return 42; } };
                    ^

Unfortunately, this does occur in real code so it would be nice if we could
support it.

-- 
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/20140821/68b51b1a/attachment.html>


More information about the llvm-bugs mailing list