class Foo { public: Foo() = delete; private: Foo(int){}; public: static void foo(); }; void Foo::foo() { Foo f1; //illegal Foo f2(1); //legal } int main() { }
Standard input is empty
prog.cpp: In static member function 'static void Foo::foo()': prog.cpp:4:5: error: deleted function 'Foo::Foo()' prog.cpp:14:8: error: used here
Standard output is empty