Skip to content

Commit

Permalink
Make sure /Zc:__cplusplus is set for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Sep 2, 2024
1 parent b27e859 commit 17eddb5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ config("compiler") {
} else {
cflags_cc += [ "/std:c++20" ]
}
if (!is_clang) {
# Required for the __cplusplus macro definition to match the C++ version
# on MSVC. clang-cl defines it by default and doesn't need this flag.
# See: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
cflags_cc += [ "/Zc:__cplusplus" ]
}
} else if (!is_nacl) {
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either
# gnu11/gnu++11 or c11/c++11; we technically don't need this toolchain any
Expand Down

0 comments on commit 17eddb5

Please sign in to comment.