This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48873] [C++0x][noexcept] Placement-new problem with deleted destructors
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 5 May 2011 07:38:48 +0000
- Subject: [Bug c++/48873] [C++0x][noexcept] Placement-new problem with deleted destructors
- Auto-submitted: auto-generated
- References: <bug-48873-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48873
--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2011-05-05 07:31:21 UTC ---
More information after some analysis: The problem occurs in other unevaluated
contexts as well and it is similarly sensitive to very small modifications of
the class definition as has been demonstrated in bug 48872. Consider the
following alternative test case involving decltype:
//----------------
#include <new>
//#define ADD_CTOR
struct D {
#ifdef ADD_CTOR
D();
#endif
~D() = delete;
};
template<class T>
T&& create();
typedef decltype(::new (((void*) 0)) D(create<D&&>())) type; // #
//----------------
As written, we get the same error message as before,
"error: use of deleted function 'D::~D()'"
but if we uncomment the line
//#define ADD_CTOR
the program becomes accepted. The user-declared constructor can also be a
non-special member of the class as has been shown in bug 48872. A defaulted
special member again shows the original buggy behaviour.