[LLVMbugs] [Bug 18675] New: [MS ABI] Function template specializations get the wrong linkage?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 30 11:54:16 PST 2014


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

            Bug ID: 18675
           Summary: [MS ABI] Function template specializations get the
                    wrong linkage?
           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
            Blocks: 12477
    Classification: Unclassified

Compiling and linking the following two files with clang-cl fails:

a.cc:

  template<typename T> struct S {
    void f() { }
  };
  template<> void S<int>::f() {
    // Specialization.
  }

  void g();
  int main() {
    S<int> s;
    s.f();
    g();
  }

b.cc:

  template<typename T> struct S {
    void f() { }
  };
  template<> void S<int>::f() {
    // Specialization.
  }

  void g() {
    S<int> s;
    s.f();
  }

The linker complains that "public: void __thiscall S<int>::f(void)"
(?f@?$S at H@@QAEXXZ) is already defined.

It links fine if compiled with cl.exe.

-- 
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/20140130/c4dc441e/attachment.html>


More information about the llvm-bugs mailing list