Skip to content

Commit a8e3feb

Browse files
committed
Merge pull request godotengine#96244 from Repiteo/scons/msvc-__cplusplus
SCons: Pass `/Zc:__cplusplus` in MSVC builds
2 parents 38447c5 + 4c84cb6 commit a8e3feb

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

SConstruct

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ else:
791791
# Note that this is still not complete conformance, as certain Windows-related headers
792792
# don't compile under complete conformance.
793793
env.Prepend(CCFLAGS=["/permissive-"])
794+
# Allow use of `__cplusplus` macro to determine C++ standard universally.
795+
env.Prepend(CXXFLAGS=["/Zc:__cplusplus"])
794796

795797
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
796798
# saves around 20% of binary size and very significant build time (GH-80513).

core/typedefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
#include "core/error/error_list.h"
4545
#include <cstdint>
4646

47+
// Ensure that C++ standard is at least C++17. If on MSVC, also ensures that the `Zc:__cplusplus` flag is present.
48+
static_assert(__cplusplus >= 201703L);
49+
4750
// Turn argument to string constant:
4851
// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing
4952
#ifndef _STR

0 commit comments

Comments
 (0)