http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48872
--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com>
2011-05-05 07:15:12 UTC ---
(In reply to comment #1)
More information by a different example: It seems that the problem case reacts
very sensitive to minor modifications of the class. The following provides a
slightly different version of the previous example:
//---------------
#include <new>
//#define ADD_CTOR
struct U2 {
#ifdef ADD_CTOR
U2(int) noexcept;
#endif
~U2() noexcept(false);
};
template<class T>
T&& create() noexcept;
const bool b = noexcept(::new (((void*) 0)) U2(create<U2&&>()));
static_assert(b, "Ouch"); // #
//---------------
As written, the same static assert violation occurs as in the example provided
by comment 1. But if the line
//#define ADD_CTOR
is uncommented *without any further changes* the program becomes accepted.
Somehow the addition of the user-provided constructor - even though it is not
used here - influences the evaluation of the noexcept expression.