Skip to content

Match strong typedef copy constructor exception guarantees - #177

Open
mikamikasuki wants to merge 1 commit into
foonathan:mainfrom
mikamikasuki:fix/strong-typedef-copy-noexcept
Open

mikamikasuki wants to merge 1 commit into
foonathan:mainfrom
mikamikasuki:fix/strong-typedef-copy-noexcept

Conversation

@mikamikasuki

Copy link
Copy Markdown

The value constructor taking const T& is currently reported as potentially throwing even when copying T cannot throw. Give it noexcept(std::is_nothrow_copy_constructible<T>::value), matching the existing conditional guarantee on the move constructor.

The regression covers six copy/move trait combinations and checks that throwing copies and moves still propagate their exceptions.

Validation with Apple Clang 16 on macOS:

  • Full Debug suite: 49 test cases, 2834 assertions. Full Release suite: 49 test cases, 2797 assertions.
  • Strict C++11, 14, 17, 20, and 23 consumers pass -Wall -Wextra -Werror -pedantic-errors.
  • Focused copy/move exception checks pass ASan/UBSan.

Fixes #167.

Prepared with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strong_typedef::strong_typedef(const T& value) is not marked noexcept even for trivial types

1 participant