[clang] [C++20] [Modules] Introduce -fgen-reduced-bmi (PR #85050)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 19:57:04 PDT 2024


ChuanqiXu9 wrote:

> Using `-fgen-reduced-bmi` currently fails for me with a case that looks like this:
> 
> ```c++
> // a.hpp
>   template <typename T>
>   void ignore(T const &) noexcept {}
>   
>   inline void resultCheck(char const *message) {
>       ignore(message);
>   }
>   
> // b.cppm
>     module;
>     #include "a.hpp"
>     export module b;
>     
>     export {
>         using ignore;
>         using resultCheck;
>     }
>     
> // c.cppm
>     export module c;
>     import b;
>     
>     export void test() {
>         resultCheck(nullptr);
>     }
> ```
> 
> This will result in this linker error: `undefined reference to void ignore<char const*>(char const* const&)`. Removing `-fgen-reduced-bmi` will result in linking without errors. Do I need to pass certain flags to CMake?

This may be fixed in trunk. This should be a bug in Reduced BMI. Note that the current patch is only the driver part of Reduced BMI. And this is the reason why we need a new flag. Otherwise I'll propose to enable it by default : )

https://github.com/llvm/llvm-project/pull/85050


More information about the cfe-commits mailing list