Where does the C ++ standard indicate that a default constructor is not created when a copy constructor is deleted?

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?

+4
source share
1 answer

From N3485 §12.1 [class.ctor] / 5:

If there is no constructor declared by the user for class X, a constructor without parameters is implicitly declared as default (8.4).

Foo(Foo const &) = delete; - , .

+10

All Articles