aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cxx/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-06 13:53:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-06 13:53:00 +0200
commita8ff78d8b90d6f7a45c9586449986dadb65809c8 (patch)
tree336dd58acf9e7bcb29960a584bff416cbbb73a78 /libbuild2/cxx/init.cxx
parent5482d1db320a86a0eccfa4118528261e77194eda (diff)
Fix basic issues with C++20 named modules support in Clang
Note that modules support now require Clang 16 or later.
Diffstat (limited to 'libbuild2/cxx/init.cxx')
-rw-r--r--libbuild2/cxx/init.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index 0d4faf2..3023ad5 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -433,6 +433,8 @@ namespace build2
}
case compiler_type::clang:
{
+ // @@ TMP: revise
+ //
// At the time of this writing, support for C++20 modules in
// Clang is incomplete. And starting with Clang 9 (Apple Clang
// 11.0.3), they are enabled by default in the C++2a mode which
@@ -448,8 +450,16 @@ namespace build2
//
if (modules.value)
{
+ if (mj < 16)
+ {
+ fail << "support for C++ modules requires Clang 16 or later" <<
+ info << "C++ compiler is " << ci.signature <<
+ info << "required by " << project (rs) << '@' << rs;
+ }
+
+ // See https://github.com/llvm/llvm-project/issues/71364
+ //
prepend ("-D__cpp_modules=201704"); // p0629r0
- mode.push_back ("-fmodules-ts"); // For the hack to work.
modules = true;
}