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 libstdc++/51452] New: has_nothrow_.*constructor bugs


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" );


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