[Bug c++/48872] New: [C++0x][noexcept] Placement-new problem with non-empty arguments
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Wed May 4 15:35:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48872
Summary: [C++0x][noexcept] Placement-new problem with non-empty
arguments
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
gcc 4.7.0 20110430 (experimental) in C++0x mode rejects the following program:
//--------------
#include <new>
struct U {};
template<class T>
T&& create();
const bool b = noexcept(::new (((void*) 0)) U(create<U&&>()));
static_assert(b, "Ouch"); // #
int main() {}
//--------------
At the line marked with # the static_assert fires. The same problem occurs, if
the initializer of U is e.g. create<U&>() or create<const U&>(), but a program
with an empty initializer like
const bool b = noexcept(::new (((void*) 0)) U());
is accepted. In either case no operation which potentially throws an exception
is called, therefore the program should be accepted.
More information about the Gcc-bugs
mailing list