Explicit destructor call with decltype
问题 Consider the following snippet: struct Foo {}; int main() { Foo f; f.~decltype(f)(); // fine with clang, error with gcc f.~decltype(auto)(); // error with both clang and gcc } The rules for an explicit destructor call are handled by the standard grammar with pseudo-destructor-name which is defined as follows: pseudo-destructor-name: nested-name-specifier opt type-name :: ~ type-name nested-name-specifier template simple-template-id :: ~type-name ~ type-name ~ decltype-specifier And: decltype