[Bug libstdc++/51452] New: has_nothrow_.*constructor bugs

dave@boost-consulting.com gcc-bugzilla@gcc.gnu.org
Wed Dec 7 16:56:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452

             Bug #: 51452
           Summary: has_nothrow_.*constructor bugs
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dave@boost-consulting.com


The traits that detect nothrow constructibility are buggy because they are
influenced by whether the object has a nothrow dtor; destruction is invoked at
the end of evaluation of the full expression in the noexcept( ... ) operator. 
They all use the pattern of constructing a temporary inside noexcept, whereas
they should be using placement new:


  struct X
  {
      X() noexcept;
      ~X();
  };

  static_assert( noexcept( X() ), "fails because of ~X" );
  static_assert( noexcept(new (nullptr) X()), "works" );



More information about the Gcc-bugs mailing list