https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123758
Bug ID: 123758
Summary: warning: base class ‘class std::polyfunc::_Mo_base’
should be explicitly initialized in the copy
constructor [-Wextra]
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: tkaminsk at gcc dot gnu.org
Target Milestone: ---
#include <functional>
int main()
{
std::copyable_function<void()> f;
}
g++ -std=c++26 func.cc -Wextra -Wsystem-headers
In file included from /home/jwakely/gcc/16/include/c++/16.0.1/functional:93,
from func.cc:1:
/home/jwakely/gcc/16/include/c++/16.0.1/bits/funcwrap.h: In copy constructor
'std::__polyfunc::_Cpy_base::_Cpy_base(const std::__polyfunc::_Cpy_base&)':
/home/jwakely/gcc/16/include/c++/16.0.1/bits/funcwrap.h:497:7: warning: base
class 'class std::__polyfunc::_Mo_base' should be explicitly initialized in the
copy constructor [-Wextra]
497 | _Cpy_base(_Cpy_base const& __x)
| ^~~~~~~~~
I think this should have `: _Mo_base()` on the copy constructor to avoid the
warning.