Skip to content

Commit

Permalink
fix: direct-init const ref instead of list-init (#1175)
Browse files Browse the repository at this point in the history
fixes: #1162

gcc has a bug that generates a call to the copy constructor when list
initializing a const reference. This PR offers a workaround which is to
direct initialize the value.

see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117900
  • Loading branch information
carsonRadtke authored Dec 13, 2024
1 parent aed09c4 commit 8a0e3d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/gsl/pointers
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public:
not_null(const not_null& other) = default;
not_null& operator=(const not_null& other) = default;
constexpr details::value_or_reference_return_t<T> get() const
noexcept(noexcept(details::value_or_reference_return_t<T>{std::declval<T&>()}))
noexcept(noexcept(details::value_or_reference_return_t<T>(std::declval<T&>())))
{
return ptr_;
}
Expand Down

0 comments on commit 8a0e3d8

Please sign in to comment.