[Bug c++/84012] [8 regression] error: cannot convert ‘const std::shared_ptr<std::a>’ to ‘std::a*’ in return

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 24 12:06:00 GMT 2018


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The code is invalid, it only works with older versions of GCC and Clang because
you never instantiate the function template and so the bug isn't detected.
Obviously if you try to use the function then it won't compile, because there's
no conversion. Why do you expect it to compile?

See https://gcc.gnu.org/gcc-7/porting_to.html#hypothetical-instantiation


More information about the Gcc-bugs mailing list