[Bug c++/104636] implicit use of explicit constructor
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 5 22:48:26 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104636
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-03-05
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a pedantic error.
clang errors out with:
<source>:14:12: error: chosen constructor is explicit in copy-initialization
return {};
^~
With -pedantic-errors GCC does error out:
<source>: In function 'foo get_value()':
<source>:14:13: error: converting to 'foo' from initializer list would use
explicit constructor 'foo::foo(const char*, uint8_t)'
return {};
^
<source>:14:13: note: in C++11 and above a default constructor can be explicit
So I don't know if there is a bug to be fixed here or not.
More information about the Gcc-bugs
mailing list