This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/79433] __has_include(<new header>) is true but #include <new header> gives #error when -std=old
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 13 Feb 2017 10:01:49 +0000
- Subject: [Bug libstdc++/79433] __has_include(<new header>) is true but #include <new header> gives #error when -std=old
- Auto-submitted: auto-generated
- References: <bug-79433-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79433
--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #19)
> (In reply to Jonathan Wakely from comment #16)
> > Even if we moved our headers to separate directories, it wouldn't make
> > __has_include sufficient..
>
> Could you explain why? It would be a pain for other compilers using
> libstdc++ to add a suitable list of directories, but I don't immediately see
> why that would fail.
As I wrote:
Or you could include it, and it doesn't define anything, because all its
contents are hidden behind a #if __cplusplus > 201402L check (which is what
happens with libc++). So you include the header, try to use the library types
it is supposed to define, and get a compiler error.
i.e. it wouldn't make __has_include sufficient for portable checks.
A solution that only work for GCC isn't a very good solution, because the whole
point of the feature-test macros is to have portable checks that work across
implementations. I've spoken to the libc++ maintainers and they are strongly
opposed to lots of different sub-directories.