<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Explicit specialization of class template member function doesn't work with -cxx-abi microsoft"
   href="http://llvm.org/bugs/show_bug.cgi?id=18141">18141</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Explicit specialization of class template member function doesn't work with -cxx-abi microsoft
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, rafael.espindola@gmail.com, rnk@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>