mardi 29 mars 2016

C++: What does noexcept exactly apply to for a constructor?

According to the C++ standard, what exactly does a noexcept noexcept-specification on a class constructor apply to?

  1. the function-body?
    1. initialization of members in the optional ctor-initializer?
      1. initialization of base classes in the optional mem-initializers?
      2. initialization of class members in the optional mem-initializers?
    2. the compound-statement?
    3. the function-try-block?
  2. initialization of object base classes not initialized in the ctor-initializer?
  3. initialization of object class members not initialized in the ctor-initializer?
  4. something additional?

In other words, which of the above trigger the noexcept noexcept-specification (i.e. std::unexpected() is called) if they throw but don't catch an exception?

Please provide references to the standard, if possible. Caveats are also welcome. Thanks!

Aucun commentaire:

Enregistrer un commentaire