Understanding C++ reconstruct syntax
c++, constructor, language-lawyer, scope, syntax
Solution
You shouldn't be able to call the constructor like this, as a member function call. The reason is (n3242, 12.1/2):
A constructor is used to initialize objects of its class type. Because constructors do not have names, they are never found during name lookup; however an explicit type conversion using the functional notation (5.2.3) will cause a constructor to be called to initialize an object.
If you really really want to call constructor on something what should be an object - and you shouldn't do it unless in very special cases - you can use placement new that calls the constructor:
new (&a) A();
Problem
Can we call an object's constructor again after it is created? ``` #include <iostream> struct A { A ( ) { std::cout << "A::A" << std::endl; } ~A ( ) { std::cout << "A::~A" << std::endl; } }; int main( ) { A a; a.~A(); // OK a.A::A(); // OK in Visual Studio 2005, 2008, 2010 return 0; } ```