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: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com
                CC: ja...@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.

Reply via email to