You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
structTrivialButPotentiallyThrowingDestructor {
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.
Suggested resolution:
The text was updated successfully, but these errors were encountered:
frederick-vs-ja
changed the title
[class.temporary] noexcept with trivial but potentially-throwing special member functions
[class.temporary] noexcept operator with trivial but potentially-throwing special member functions
Apr 27, 2024
jensmaurer
changed the title
[class.temporary] noexcept operator with trivial but potentially-throwing special member functions
CWG2886 [class.temporary] noexcept operator with trivial but potentially-throwing special member functions
Apr 29, 2024
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:
The text was updated successfully, but these errors were encountered: