Can a private static member be used as a default argument to a member function of its class?

前端 未结 2 582
無奈伤痛
無奈伤痛 2021-01-19 01:34

Which one of the compilers is right ?

class A
{
public:
   template 
   void fun(void (*f)() = funPrivate) {}
private:
   template         


        
2条回答
  •  执笔经年
    2021-01-19 01:54

    I have tested code in msvc13. This code works:

    class A
    {
      template 
      static void funPrivate() {}
    public:
      template 
      void fun(void (*f)() = funPrivate) {}
    };
    

提交回复
热议问题