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

Werner LEMBERG via cfe-users cfe-users at lists.llvm.org
Sat Nov 3 15:19:27 PDT 2018


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

Can you point out a solution?



class A {
  template <void (A::*mf)()>
  void zip () { }
  void fun () { }
class B : public A
  using A::zip; // Fails to involve A::zip in overloading resolution
  template <void (B::*mf)()>
  void zip () { }
} bex;
void x ()
  bex.zip <&B::fun> ();

More information about the cfe-users mailing list