[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 08:36:40 PST 2018


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20181105/f13898ed/attachment.html>


More information about the cfe-users mailing list