summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-15 11:58:18 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-18 15:10:12 (GMT)
commit9dfb66372ee398a9587364c42ed9c54cc226ced9 (patch)
treee900d4a407ce4811fcc76b297d2a4a59c66ea8ca /bootstrap
parente3bd5c5b666e515319d81f8218e2f71c11169304 (diff)
downloadCMake-9dfb66372ee398a9587364c42ed9c54cc226ced9.zip
CMake-9dfb66372ee398a9587364c42ed9c54cc226ced9.tar.gz
CMake-9dfb66372ee398a9587364c42ed9c54cc226ced9.tar.bz2
bootstrap: Verify C++14 capabilities before using them
In commit a605bf438e (Extend C++17/C++14 feature checks to cover more standard library APIs, 2019-02-27, cpp-modules-20190312.1~52^2~1) we added checks to the main build of CMake to verify C++14 capabilities before using C++14 flags to build. Add these to the bootstrap check too.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap21
1 files changed, 20 insertions, 1 deletions
diff --git a/bootstrap b/bootstrap
index c2194fe..41431cc 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1125,6 +1125,25 @@ echo '
#error "SunPro <= 5.13 mode not supported due to bug in move semantics."
#endif
+#if __cplusplus > 201103L
+#include <iterator>
+int check_cxx14()
+{
+ int a[] = { 0, 1, 2 };
+ auto ai = std::cbegin(a);
+
+ int b[] = { 2, 1, 0 };
+ auto bi = std::cend(b);
+
+ return *ai + *(bi - 1);
+}
+#else
+int check_cxx14()
+{
+ return 0;
+}
+#endif
+
class Class
{
public:
@@ -1135,7 +1154,7 @@ private:
int main()
{
auto const c = std::unique_ptr<Class>(new Class);
- std::cout << c->Get() << std::endl;
+ std::cout << c->Get() << check_cxx14() << std::endl;
return 0;
}
' > "${TMPFILE}.cxx"