[Bug libstdc++/80451] [6/7 Regression] return implicit type conversion to std::experimental::optional does not compile
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 18 16:14:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80451
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Денис Крыськов from comment #8)
> If I understand correctly,
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579 is not
> implemented in gcc 5.4 and 6.3. Which means some code runs slower than is
> should. To be sure that a fast constructor is called, I need to delete slow
> constructor.
>
> Which results in bloated code (each and every class should contain delete
> statement).
No, if you define a move constructor then the implicitly-declared copy
constructor is automatically deleted. So if you think explicitly deleting it is
"bloated code" then simply don't do that and let the compiler implicitly delete
it for you.
> If that's not serious, that's unpleasant.
So do "return std::move(b);" as was necessary before 2014 anyway.
This is a bug, and it will be fixed, but there's no need to exaggerate its
seriousness.
More information about the Gcc-bugs
mailing list