Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [class.temporary]
Link to reflector thread (if any):
Issue description:
[class.temporary] p4 seemingly allows, but does not guarantee, that a trivial special member function is not called in the mentioned cases. As P1286R2 allowed trivial, eligible/non-deleted, but potentially-throwing (noexcept(false)) special member functions, the difference on whether such a special member function is called can be observed by a noexcept-expression.
There is implementation divergence on this (Godbolt link). It's unclear whether the implementation divergence is intended.
struct TrivialButPotentiallyThrowingDestructor {
TrivialButPotentiallyThrowingDestructor() = default;
~TrivialButPotentiallyThrowingDestructor() noexcept(false) = default;
};
static_assert(noexcept(TrivialButPotentiallyThrowingDestructor{}), "???"); // EDG thinks the dtor is called, while others don't.
Also, it is unclear in [class.temporary] p3 whether the constructor or destructor call in the creation of a temporary object holding the function parameter is considered observable via a noexcept-expression. It seems intended that the implementation should only perform bitwise copy and the exception specification shouldn't be considered.
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [class.temporary]
Link to reflector thread (if any):
Issue description:
[class.temporary] p4 seemingly allows, but does not guarantee, that a trivial special member function is not called in the mentioned cases. As P1286R2 allowed trivial, eligible/non-deleted, but potentially-throwing (
noexcept(false)
) special member functions, the difference on whether such a special member function is called can be observed by anoexcept
-expression.There is implementation divergence on this (Godbolt link). It's unclear whether the implementation divergence is intended.
Also, it is unclear in [class.temporary] p3 whether the constructor or destructor call in the creation of a temporary object holding the function parameter is considered observable via a
noexcept
-expression. It seems intended that the implementation should only perform bitwise copy and the exception specification shouldn't be considered.Suggested resolution: