Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit a2064f7

Browse files
authored
Update to C++17 (#310)
1 parent ebd5a47 commit a2064f7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/Simulation/Native/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set(MICROSOFT_QUANTUM_SIMULATOR_VERSION $ENV{ASSEMBLY_VERSION})
1919
set(MICROSOFT_QUANTUM_VERSION_STRING "quarcsw simulator version ${MICROSOFT_QUANTUM_SIMULATOR_VERSION}")
2020
MESSAGE(STATUS "QUARCSW version: ${MICROSOFT_QUANTUM_SIMULATOR_VERSION}")
2121

22-
set(CMAKE_CXX_STANDARD 14)
22+
set(CMAKE_CXX_STANDARD 17)
2323
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2424

2525
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)

src/Simulation/Native/src/SafeInt.hpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ Please read the leading comments before using the class.
4747
#define CPLUSPLUS_STD CPLUSPLUS_98
4848
#elif __cplusplus < 201402L
4949
#define CPLUSPLUS_STD CPLUSPLUS_11
50-
#else
50+
#elif __cplusplus < 201703L
5151
#define CPLUSPLUS_STD CPLUSPLUS_14
52+
#else
53+
#define CPLUSPLUS_STD CPLUSPLUS_17
5254
#endif
5355

5456
#elif SAFEINT_COMPILER == VISUAL_STUDIO_COMPILER
@@ -60,10 +62,13 @@ Please read the leading comments before using the class.
6062
#elif _MSC_VER < 1910 // VS 2015
6163
#define CPLUSPLUS_STD CPLUSPLUS_11
6264

63-
#else // VS 2017 or later
65+
#elif _MSC_VER < 1926 // VS 2017
66+
#define CPLUSPLUS_STD CPLUSPLUS_14
67+
68+
#else // VS 2019 or later
6469
// Note - there is a __cpp_constexpr test now, but everything prior to VS 2017 reports incorrect values
6570
// and this version always supports at least the CPLUSPLUS_14 approach
66-
#define CPLUSPLUS_STD CPLUSPLUS_14
71+
#define CPLUSPLUS_STD CPLUSPLUS_17
6772

6873
#endif
6974

@@ -72,8 +77,8 @@ Please read the leading comments before using the class.
7277
#define CPLUSPLUS_STD CPLUSPLUS_98
7378
#endif // Determine C++ support level
7479

75-
#if (SAFEINT_COMPILER == CLANG_COMPILER || SAFEINT_COMPILER == GCC_COMPILER) && CPLUSPLUS_STD < CPLUSPLUS_11
76-
#error Must compile with --std=c++11, preferably --std=c++14 to use constexpr improvements
80+
#if (SAFEINT_COMPILER == CLANG_COMPILER || SAFEINT_COMPILER == GCC_COMPILER) && CPLUSPLUS_STD < CPLUSPLUS_17
81+
#error Must compile with --std=c++17
7782
#endif
7883

7984
#define CONSTEXPR_NONE 0

0 commit comments

Comments
 (0)