<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60027>60027</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20][Modules] Can't use same legacy header in different modules
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SasisaDev
</td>
</tr>
</table>
<pre>
```c++
module;
#include <concepts>
export module Services:Service;
```
```c++
module;
#include <iostream>
export module Log;
```
Results in this error
```
D:\VisualStudio\VC\Tools\MSVC\14.34.31933\include\vcruntime_new.h:27:16: error: 'std::align_val_t' has different definitions in different modules; definition in module 'Log.<global>' first difference is enum with specified type 'size_t' (aka 'unsigned long long')
enum class align_val_t : size_t {};
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
D:\VisualStudio\VC\Tools\MSVC\14.34.31933\include\vcruntime_new.h:27:16: note: but in 'Services:Service.<global>' found enum with specified type 'size_t' (aka 'unsigned long long')
enum class align_val_t : size_t {};
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
Both headers at one point include vcruntime_new.h header.
No `using namespace std;` used.
Obviously, definitions are not different, they're just not removed by clang when building tree.
I used these commands to build
```
[PCM] clang++ -std=c++20 -fmodules -g -O0 -Wall -DPLATFORM_WINDOWS
-fprebuilt-module-path=D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Engine.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Services.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Engine.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Services.lib
--precompile D:\UnixProjects\General\Bismuth\BismuthEngine\Source\Engine\Application\Application.cppm
-o D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Application.pcm
[LIB] clang++ -std=c++20 -fmodules -g -O0 -Wall -DPLATFORM_WINDOWS
-fprebuilt-module-path=D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Engine.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Services.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Engine.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Services.lib
-c D:\UnixProjects\General\Bismuth\BismuthEngine\Source\Engine\Application\Application.cppm
-o D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Application_temp\Application_interface.obj
[LINKER] lld-link /lib D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Engine.lib
D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Services.lib
/out:D:\UnixProjects\General\Bismuth\BismuthEngine\Intermediate\Modules\Application.lib
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsV99v2zYQ_mvOLwcZMmlZ8YMfbCkegiVN0XTrY0BJZ4ktRQok5TR76N8-UFJ-tVmHdWs2DDUESZRO9919dx9NCudkrYk2kOwgyWei942xmyvhpBM5HWeFqW43sIrHowS2C0ecQ7xtTdUrAj4NpzPjUpeqrwiBZ6XRJXXeAT99bEQfO2M9jg7wiuxRluSAb6fbB593wE8gvjUaaZy3JNqvRnNu6q_DvyHXK-9QavSNdEjWGvusfQ58C0n2q3S9UFe-r6QJwwyS7K0xykGSXVwNw8VyzpdzvlhzDkk2hQxJdixtr71s6VrTzbwBvmUp8O1iBXw7AfMtAkudrwIY3wola319FOraA0uxEQ4reTiQJe2xooPU0kujh_AfXoy5O-C7RzbBZCIFWHpu6jnwrFamECowyFI8SOv8vZuSMNCh-xZvpG_QdVTKg6QK_W03-HDyNxrjAnYiPojwrNdDB1aojK6HE7AU2HqkEBFHj6USzuGj7DBkPjpESHe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