[cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

David Blaikie via cfe-users cfe-users at lists.llvm.org
Mon Nov 5 10:38:05 PST 2018


Ah, good point - I didn't think to simplify the template argument
list/types too!

On Mon, Nov 5, 2018 at 10:18 AM Jan Korous <jkorous at apple.com> wrote:

> I minimized the reproducer. Seems like base class template methods are not
> included in derived object method name resolution.
>
> Knowing whether it violates the standard or not is beyond my knowledge
> though.
>
> type params
> https://godbolt.org/z/WpET78
>
> nontype params
> https://godbolt.org/z/PZIaDn
>
> Jan
>
>
> On Nov 5, 2018, at 4:36 PM, David Blaikie via cfe-users <
> cfe-users at lists.llvm.org> wrote:
>
> Yeah, looks like a bug in Clang to me - CC'ing Richard Smith in case this
> is quick/easy/obvious to him. Here's my slightly modified test case
> comparing Clang and GCC's behavior, and adding a non-member overload
> situation to demonstrate that that works on both compilers:
> https://godbolt.org/z/cTq06R
>
> On Sat, Nov 3, 2018 at 3:19 PM Werner LEMBERG via cfe-users <
> cfe-users at lists.llvm.org> wrote:
>
>>
>> Folks,
>>
>>
>> below is a MWE that compiles fine with g++ but fails with clang
>> (tested version 6.0.1 on a GNU/Linux box):
>>
>>   clang-problem.cpp:19:7: error:
>>       no matching member function for call to 'zip'
>>     bex.zip <&B::fun> ();
>>     ~~~~^~~~~~~~~~~~~
>>   clang-problem.cpp:13:8: note: candidate template ignored:
>>       invalid explicitly-specified argument for template parameter 'mf'
>>     void zip () { }
>>          ^
>>
>> To my best knowledge, the code is valid C++.  This means there are two
>> possible corrolaries: either I'm wrong, and it is not valid C++
>> according to the standard, or clang++ has a bug.  Hopefully, it's the
>> former.
>>
>> Can you point out a solution?
>>
>>
>>     Werner
>>
>>
>> ======================================================================
>>
>>
>> class A {
>> public:
>>   template <void (A::*mf)()>
>>   void zip () { }
>>   void fun () { }
>> };
>>
>> class B : public A
>> {
>> public:
>>   using A::zip; // Fails to involve A::zip in overloading resolution
>>   template <void (B::*mf)()>
>>   void zip () { }
>> } bex;
>>
>>
>> void x ()
>> {
>>   bex.zip <&B::fun> ();
>> }
>>
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20181105/b3cec1ad/attachment.html>


More information about the cfe-users mailing list