Destructor call for scalar types & undefined behavior [duplicate]
问题 This question already has an answer here : Pseudo-destructor call does not destroy an object (1 answer) Closed 5 years ago . I just wrote following program & it compiles & runs fine. (see live demo here.) #include <iostream> typedef int T; int main() { int a=3; std::cout<<a<<'\n'; a.~T(); std::cout<<a; return 0; } Why the program compiles fine? If I am not wrong scalar types don't have constructor and destructor in C++ . So, is this program well defined? Does explicit call to destructor