This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48872] [C++0x][noexcept] Placement-new problem with non-empty arguments
- 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:20:21 +0000
- Subject: [Bug c++/48872] [C++0x][noexcept] Placement-new problem with non-empty arguments
- Auto-submitted: auto-generated
- References: <bug-48872-4@http.gcc.gnu.org/bugzilla/>
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.