[Dune-devel] C++17: feature macros and exit status of tests that require C++17

Steffen Müthing steffen.muething at iwr.uni-heidelberg.de
Tue May 16 13:38:51 CEST 2017


Hi Ansgar,

> Am 15.05.2017 um 17:16 schrieb Ansgar Burchardt <Ansgar.Burchardt at tu-dresden.de>:
> 
> Hi,
> 
> I played around with new C++17 features some time ago.  One nice
> feature for me is the class template deduction for which I would like
> to eventually include optional support in the core modules, that is
> provide user-defined deduction guides in a few places.
> 
> How should such optional support be guarded?  As a lazy person I just
> used
> 
>  #if __cplusplus >= 201402L
>  // optional support for c++17
>  #endif
> 
> so far.  Sadly the proposal for feature test macros[1] doesn't seem to
> have been adopted, at least I couldn't find a newer version of it.

Yes, that list looks rather incomplete :-(

In the past, we have handled features like that by adding a test to CheckCXXFeatures.cmake
and providing a DUNE-specific preprocessor define. That’s how I would do it here as well.

> 
>  [1] https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
> 
> For test programs including only tests for this optional C++17 support,
> I would just exit with status 77 (skipped) in case C++17 is not
> supported by the compiler.

Sounds good to me.

Steffen

> 
> Ansgar
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20170516/fe4e7235/attachment.sig>


More information about the Dune-devel mailing list