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

            Bug ID: 110092
           Summary: Missing warning that internal header is used
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: piotrwn1 at gmail dot com
  Target Milestone: ---

Developers new to C++ have sometime problems with including proper std library
header, instead, they sometimes include standard library internal headers -
since the definition is there and some IDE shows "you have this entity here".

I have tried "-Wall -Wextra -pedantic" and nothing warns me when, just for
example purposes, I included `<bits/shared_ptr.h>` whilst `<memory>` should
included.

I see in this "internal" header (bits/shared_ptr.h) the following information:

```
44      /** @file
45       *  This is an internal header file, included by other library headers.
46       *  Do not attempt to use it directly. @headername{memory}
47       */
```

So, probably it is doable to add warning like: "bist/shared_ptr.h is an
internal header file, included by other library headers. Do not attempt to use
it directly. Use <memory> instead"

Reply via email to