You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[libcxx][modules] Fix missing includes for windows.
Previously, I was getting the following error when attempting to compile
libc++ on windows with modules enabled.
```
While building module 'std':
In file included from <module-includes>:1:
In file included from gen/third_party/libc++/src/include/algorithm:1865:
In file included from gen/third_party/libc++/src/include/__algorithm/inplace_merge.h:28:
In file included from gen/third_party/libc++/src/include/__memory/unique_temporary_buffer.h:17:
In file included from gen/third_party/libc++/src/include/__memory/allocator.h:19:
gen/third_party/libc++/src/include/__new/allocate.h(40,73): error:
declaration of 'align_val_t' must be imported from module
'sys_stage1.sysroot_vcruntime_new_h' before it is required
40 | return static_cast<_Tp*>(__builtin_operator_new(__size, static_cast<align_val...
| ^
../../third_party/depot_tools/win_toolchain/vs_files/e4305f407e/VC/Tools/MSVC/14.44.35207/include/vcruntime_new.h(27,33): note:
declaration here is not visible
27 | _VCRT_EXPORT_STD enum class align_val_t : size_t {};
| ^
```
I also received a similar error for `std::bad_alloc`.
We have an include chain `__new/exceptions.h` => `__exception/exception.h` => `vcruntime_exception.h` => `vcruntime_new.h`. This means that it works fine with non-modules because `vcrunmite_exception.h` and `vcruntime_new.h` were both in the transitive includes.
However, this fails with modules because `__new/exceptions.h` no longer exports symbols from
`__exception/exception.h`, and thus `std::bad_alloc` and `std::align_val_t` are no longer visible.
0 commit comments