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

Reply via email to