[Bug libstdc++/78490] [c++17] libstdc++ has undefined behavior in operator= of propagate_const

felix.morgner at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 23 09:56:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78490

--- Comment #2 from Felix Morgner <felix.morgner at gmail dot com> ---
Comment on attachment 40124
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40124
Proposed patch

>--- propagate_const.org	2016-11-23 10:28:45.682529129 +0100
>+++ propagate_const.new	2016-11-23 10:28:27.076012689 +0100
>@@ -153,6 +153,7 @@
>       constexpr propagate_const& operator=(propagate_const<_Up>&& __pu)
>       {
> 	_M_t = std::move(get_underlying(__pu));
>+	return *this;
>       }
> 
>       template <typename _Up, typename =
>@@ -163,6 +164,7 @@
>       constexpr propagate_const& operator=(_Up&& __u)
>       {
> 	_M_t = std::forward<_Up>(__u);
>+	return *this;
>       }
> 
>       // [propagate_const.const_observers], const observers


More information about the Gcc-bugs mailing list