Skip to content

Commit c6ba515

Browse files
ChuanqiXu9mahesh-attarde
authored andcommitted
[C++20] [Modules] Set the feature testing macro to 1 (llvm#161034)
See llvm#71364 for details.
1 parent 5721c68 commit c6ba515

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,10 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
742742
Builder.defineMacro("__cpp_impl_coroutine", "201902L");
743743
Builder.defineMacro("__cpp_designated_initializers", "201707L");
744744
Builder.defineMacro("__cpp_impl_three_way_comparison", "201907L");
745-
//Builder.defineMacro("__cpp_modules", "201907L");
745+
// Intentionally to set __cpp_modules to 1.
746+
// See https://github.com/llvm/llvm-project/issues/71364 for details.
747+
// Builder.defineMacro("__cpp_modules", "201907L");
748+
Builder.defineMacro("__cpp_modules", "1");
746749
Builder.defineMacro("__cpp_using_enum", "201907L");
747750
}
748751
// C++23 features.

clang/test/Lexer/cxx-features.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148

149149
// init_captures checked below
150150

151-
#if check(modules, 0, 0, 0, 0, 0, 0, 0)
151+
#if check(modules, 0, 0, 0, 0, 1, 1, 1)
152152
// FIXME: 201907 in C++20
153153
#error "wrong value for __cpp_modules"
154154
#endif

0 commit comments

Comments
 (0)