This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/79433] __has_include(<new header>) is true but #include <new header> gives #error when -std=old


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]