[patch] Fix pr18141
Hans Wennborg
hans at chromium.org
Mon Dec 9 15:52:50 PST 2013
On Fri, Dec 6, 2013 at 7:17 PM, Rafael EspĂndola
<rafael.espindola at gmail.com> wrote:
> On 5 December 2013 17:23, Reid Kleckner <rnk at google.com> wrote:
>> 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?
>
> With the previous patch we would still produce an error:
>
> /Users/respindola/llvm/test.cpp:7:35: error: function declared 'cdecl'
> here was previously declared 'thiscall'
> template<> void __cdecl S<void*>::f(void*);
> ^
> /Users/respindola/llvm/test.cpp:7:35: note: previous declaration is here
>
> but clang was clearly getting confused as show by the note on the same
> line as the error.
>
>> Maybe the right thing is to use a comparison that knows how to overlook
>> implicit CC differences, but knows about explicit CC differences.
>
> The attached patch does that. With it clang prints an error about the
> __cdecl, ignores the broken specialization and continues.
I don't know this code, so can't really contribute to the review here,
but this patch makes the following tests pass in ms abi mode, which I
really like :)
CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
CXX/temp/temp.spec/temp.expl.spec/p2.cpp
CXX/temp/temp.spec/temp.expl.spec/p21.cpp
CXX/temp/temp.spec/temp.expl.spec/p4.cpp
CXX/temp/temp.spec/temp.expl.spec/p5.cpp
CXX/temp/temp.spec/temp.expl.spec/p6.cpp
CXX/temp/temp.spec/temp.explicit/p4.cpp
- Hans
More information about the cfe-commits
mailing list