C++ spooky constructor [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Why is it an error to use an empty set of brackets to call a constructor with no arguments? Lets have this code class Foo { Foo(int) { } }; Then we have there results: int main() { Foo f1 = Foo(5); // 1: OK, explicit call Foo f2(5); // 2: OK, implicit call Foo f3(); // 3: no error, "f3 is a non-class type Foo()", how so? Foo f4(f1); // 4: OK, implicit call to default copy constructor Foo f5; // 5: expected error