From 170fcd715f586cfd6b9f741c0572d472e0abe8ed Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 22 Aug 2019 08:28:08 -0400 Subject: Extend C++17 feature checks to require std::optional --- Source/Checks/cm_cxx17_check.cpp | 5 ++++- bootstrap | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp index 593d9b2..29863b1 100644 --- a/Source/Checks/cm_cxx17_check.cpp +++ b/Source/Checks/cm_cxx17_check.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #ifdef _MSC_VER @@ -27,5 +28,7 @@ int main() IDispatchPtr disp(ptr); #endif - return *u + *ai + *(bi - 1) + (3 - static_cast(ci)); + std::optional oi = 0; + + return *u + *ai + *(bi - 1) + (3 - static_cast(ci)) + oi.value(); } diff --git a/bootstrap b/bootstrap index 4581239..17dc3e8 100755 --- a/bootstrap +++ b/bootstrap @@ -1146,6 +1146,20 @@ int check_cxx14() } #endif +#if __cplusplus >= 201703L +#include +int check_cxx17() +{ + std::optional oi = 0; + return oi.value(); +} +#else +int check_cxx17() +{ + return 0; +} +#endif + class Class { public: @@ -1156,7 +1170,7 @@ private: int main() { auto const c = std::unique_ptr(new Class); - std::cout << c->Get() << check_cxx14() << std::endl; + std::cout << c->Get() << check_cxx14() << check_cxx17() << std::endl; return 0; } ' > "${TMPFILE}.cxx" -- cgit v0.12