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.

Reply via email to