C ++ 11 Program
struct Foo {
Foo(Foo const &) = delete;
};
int main() {
Foo foo;
}
generates an error
$ g++ -std=c++11 junk.cpp -o junk
junk.cpp: In function 'int main()':
junk.cpp:6:9: error: no matching function for call to 'Foo::Foo()'
junk.cpp:6:9: note: candidate is:
junk.cpp:2:5: note: Foo::Foo(const Foo&) <deleted>
junk.cpp:2:5: note: candidate expects 1 argument, 0 provided
Now it looks like the default constructor has been prevented since the copy constructor has been removed. I suppose this is the expected behavior, but where does the C ++ standard indicate that the default constructor should not be generated when the copy constructor is deleted?
source
share