[cfe-dev] What's the case if clang module and c++20 module are enabled at the same time?

chuanqi.xcq via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 3 04:50:56 PDT 2021


Hi,

   Recently I am developing C++20 semantics in clang. Then I met an interesting bug in 
compare-modules-cxx2a.cpp (https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/compare-modules-cxx2a.cpp).
    The key point here is that the test uses `-std=c++2a` and `-fmodules` both. So my codes which is intended to work for C++20 module now tests for clang module. So here is the reason for the bug.

    Beyond my personal work, it is weired for me that we could use clang module and c++20 module at the same time. (I know the implementation of c++20 is based on clang module). 
So I want to ask: do we have considered the case that we use clang module and c++20 module together? Is it neceesary? And what's the status after the user enable c++20 module and clang module?

    For example, when we enter "clang -std=c++20 -fprebuilt-module-path=%t %s -c" to the command line, both `getLangOpts().CPlusPlusModules` and `getLangOpts().Modules` would evaluate to true, which is really weired.
Is it intentional? Or is it a bug simply? Now I couldn't avoid the bug by `if (getLangOpts().CPlusPlusModules && !getLangOpts().Modules)`.

    I CCed people who looks like interested and related. Remind me if you feel uncomfortable.

Thanks,
Chuanqi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211103/9a3799a3/attachment.html>


More information about the cfe-dev mailing list