This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48872] [C++0x][noexcept] Placement-new problem with non-empty arguments


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]