[patch] Fix pr18141

Reid Kleckner rnk at google.com
Thu Dec 5 14:23:22 PST 2013


What happens for an invalid test case like:

template <typename T>
struct S {
  void f(T t) {
    t = 42;
  }
};
template<> void __cdecl S<void*>::f(void*);
void g(S<void*> s, void* p) {
  s.f(p);
}

MSVC rejects this with "error C2373: 'S<T>::f' : redefinition; different
type modifiers".  Do we just paper that over and adjust to __thiscall?
 Maybe the right thing is to use a comparison that knows how to overlook
implicit CC differences, but knows about explicit CC differences.


On Thu, Dec 5, 2013 at 1:25 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> The attached patch fixes pr18141 by taking the calling convention into
> consideration when looking for which member is being specialized.
>
> Without this patch clang falls of
>
>   if (!Instantiation) {
>     // There is no previous declaration that matches. Since member
>     // specializations are always out-of-line, the caller will complain
> about
>     // this mismatch later.
>     return false;
>   }
>
> But nothing complains, so there might be something else wrong in here.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131205/2f78f91c/attachment.html>


More information about the cfe-commits mailing list