[Development] __has_include vs GCC

Thiago Macieira thiago.macieira at intel.com
Wed Feb 8 23:49:32 CET 2017


On quarta-feira, 8 de fevereiro de 2017 20:40:04 PST Marc Mutz wrote:
> Hi,
> 
> I just filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79433
> complaining that __has_include returns true for headers which then, when
> included, #error out about the wrong C++ standard used.

I'm with you. SD-6 says that we should use __has_include to check if it 
exists, so I'd argue it shouldn't complain when we do it.

> We use this mechanism for at least <chrono>, and are either about to
> ship it or already do. That's fine since we compile at least in C++11
> mode these days.
> 
> I, however, intended to use the same feature for <string_view> and
> <experimental/string_view>, which don't seem to have SD-6 feature test
> macros (or else define them in the header which you're not allowed to
> include to check), but since we compile qmake only in C++11, not higher,
> this was greeted with an #error.
> 
> How do other compilers/platforms behave?

I don't think any of them check if the included file #errors out.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list