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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> This seems more like a bug in the IDE than in GCC. If you don't include the
> header at all then GCC tells you the right header:
> 
> sp.cc: In function ‘int main()’:
> sp.cc:2:8: error: ‘shared_ptr’ is not a member of ‘std’
>     2 |   std::shared_ptr<int> s;
>       |        ^~~~~~~~~~
> sp.cc:1:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you
> forget to ‘#include <memory>’?
>   +++ |+#include <memory>
>     1 | int main() {

Right, the IDE trying to push folks to include the wrong header files is a bug
in the IDE; not just in this case either. There are other libraries which will
have a similar issue besides libstdc++ too. IDEs trying to be smart are not
always the best thing.

Reply via email to