summaryrefslogtreecommitdiffstats
path: root/Tests/CompileFeatures
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-05 11:07:16 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-05 11:37:03 (GMT)
commit7f05d472a2f2c84baa4996b3464f690565f8ab3a (patch)
treec3353e56fa621da545576c823228c8f31214661b /Tests/CompileFeatures
parent3587579f34235255db11a2d2b11668829f256790 (diff)
downloadCMake-7f05d472a2f2c84baa4996b3464f690565f8ab3a.zip
CMake-7f05d472a2f2c84baa4996b3464f690565f8ab3a.tar.gz
CMake-7f05d472a2f2c84baa4996b3464f690565f8ab3a.tar.bz2
NVHPC: Fix detection of C++ 20 mode on NVHPC < 22.7
This compiler does not always define `__cplusplus` correctly, but does define a feature macro that we can use to distinguish this mode.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r--Tests/CompileFeatures/default_dialect.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
index 081b049..bdd5cac 100644
--- a/Tests/CompileFeatures/default_dialect.cpp
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -27,6 +27,12 @@ struct Outputter;
# endif
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
# define CXX_STD _MSVC_LANG
+#elif defined(__NVCOMPILER)
+# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
+# define CXX_STD CXX_STD_20
+# else
+# define CXX_STD __cplusplus
+# endif
#elif defined(__INTEL_COMPILER)
# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes)
# define CXX_STD CXX_STD_17