¿Se puede usar un miembro estático privado como argumento predeterminado para una función miembro de su clase?
¿Cuál de los compiladores es el correcto?
class A
{
public:
template <typename T>
void fun(void (*f)() = funPrivate<T>) {}
private:
template <typename T>
static void funPrivate() {}
};
int main(int argc, char** argv)
{
A a;
a.fun<int>();
return 0;
}
Compila bien en:gcc versión 4.8.5 (Ubuntu 4.8.5-2ubuntu1 ~ 14.04.1)
Resultados en un error en:clang versión 3.4-1ubuntu3 (etiquetas / RELEASE_34 / final) (basado en LLVM 3.4)
a.cpp:5:27: error: 'funPrivate' is a private member of 'A'
void fun(void (*f)() = funPrivate<T>) {}
^~~~~~~~~~~~~
a.cpp:14:3: note: in instantiation of default function argument expression for 'fun<int>' required here
a.fun<int>();
^
a.cpp:8:16: note: declared private here
static void funPrivate() {}
^
1 error generated.