From d590c966dbcd6faef64e87ba0fc9b105a310f7df Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Jun 2020 13:59:54 +0200 Subject: Disable Clang C++20 modules support unless explicitly forced --- libbuild2/cxx/init.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 866ec12..49ed076 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -335,14 +335,20 @@ namespace build2 } case compiler_type::clang: { - // Enable starting with Clang 6.0.0. + // 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 + // breaks the way we set things up for partial preprocessing; + // see this post for details: // - // Also see Clang modules support hack in cc::compile. + // http://lists.llvm.org/pipermail/cfe-dev/2019-October/063637.html + // + // As a result, for now, we only enable modules if forced with + // explicit cxx.features.modules=true. // - // @@ Clang 9 enables modules by default in C++2a. We should - // probably reflect this in the modules value. + // Also see Clang modules support hack in cc::compile. // - if (mj >= 6) + if (l) { r.push_back ("-D__cpp_modules=201704"); // p0629r0 r.push_back ("-fmodules-ts"); -- cgit v1.1