https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90598
Bug ID: 90598
Summary: Return type of explicit destructor call wrong
Product: gcc
Version: 9.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc at mbox dot tinloaf.de
Target Milestone: ---
With GCC 9.1, the return type for an explicit destructor call of an defaulted
destructor has changed from "void" to "void&":
----------------------------------------
#include <type_traits>
class Foo {
public:
// With this, the DestructorReturnType below becomes "void"
// ~Foo () {}
};
// … unless I specify the user-defined destructor above, in which case it is
"void"
using DestructorReturnType = decltype(std::declval<Foo>().~Foo());
template<class T>
class TD;
// Says: aggregate 'TD<void&> t' has incomplete type and cannot be defined
TD<DestructorReturnType> t;
----------------------------------------
This contradicts [expr.call], point 5.