[LLVMbugs] [Bug 18141] New: Explicit specialization of class template member function doesn't work with -cxx-abi microsoft

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 4 17:17:58 PST 2013


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

            Bug ID: 18141
           Summary: Explicit specialization of class template member
                    function doesn't work with -cxx-abi microsoft
           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, rafael.espindola at gmail.com,
                    rnk at google.com
    Classification: Unclassified

The following example, derived from
test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp, fails with clang -cc1 -target
i686-pc-win32 -cxx-abi microsoft

  $ cat a.cc
  template <typename T>
  struct S {
    void f(T t) {
      t = 42; // This doesn't work when T is void*.
    }
  };

  // So we provide a specialization for T = void*.
  template<> void S<void*>::f(void*);

  void g(S<void*> s, void* p) {
    s.f(p); // Boom.. on -target i686-pc-win32 -cxx-abi microsoft
  }

  $ clang -cc1 -triple i686-pc-win32 -cxx-abi microsoft a.cc
  a.cc:4:7: error: assigning to 'void *' from incompatible type 'int'
      t = 42; // This doesn't work when T is void*.
        ^ ~~
  a.cc:12:5: note: in instantiation of member function 'S<void *>::f' requested
here
    s.f(p); // Boom.. on -target i686-pc-win32 -cxx-abi microsoft
      ^
  1 error generated.

For some reason, the call to f doesn't get bound to the explicit
specialization.

+rafael because I suspect this has something to do with the method having
thiscall calling convention, and I know you've been doing some work in that
area.

The code works if I add __attribute__((thiscall)) to the specialization. It
also works if I make it a definition instead of just a declaration.

-- 
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/20131205/fd3d34d2/attachment.html>


More information about the llvm-bugs mailing list