[Bug libstdc++/85831] New: <stdexcept> types should have move constructors and move assignment operators

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 18 16:16:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85831

            Bug ID: 85831
           Summary: <stdexcept> types should have move constructors and
                    move assignment operators
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

The standard says:

namespace std {
 class logic_error : public exception {
 public:
   explicit logic_error(const string& what_arg);
   explicit logic_error(const char* what_arg);
 };
}

The lack of user-declared special members means that a move constructor and
move assignment operator should be implicitly declared.

But we define:

 class logic_error : public exception
 {
   [...]

   virtual ~logic_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;

   [...]
 };

The user-declared destructor means there is no move constructor or move
assignment operator.

(The user-defined destructor is the key function and ensures the vtable and
RTTI are only emitted in the library, not in every TU).


More information about the Gcc-bugs mailing list