<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/79386>79386</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20][Modules] error: '_freea' has different definitions 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>
Ivan171
</td>
</tr>
</table>
<pre>
### Environment
Windows 10
Clang 18.0.0git (https://github.com/llvm/llvm-project f9da4c6eadf478a3828362bdfa9ec5136e8c131b)
MSVC 17.8.3
### Reproducer
```c++
// mod2.cpp
module;
#include <algorithm>
export module mod2;
```
```c++
// mod1.cpp
module;
#include <string_view>
export module mod1;
import mod2;
```
```
$ clang++.exe -std=c++20 -fno-delayed-template-parsing -fno-ms-compatibility -x c++-module mod2.cpp --precompile
$ clang++.exe -std=c++20 -fno-delayed-template-parsing -fno-ms-compatibility -x c++-module mod1.cpp -fprebuilt-module-path=.
In module 'mod2' imported from mod1.cpp:7:
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\malloc.h:150:29: error: '_freea' has different definitions in
different modules; definition in module 'mod2.<global>' first difference is function body
150 | __inline void __CRTDECL _freea(_Pre_maybenull_ _Post_invalid_ void* _Memory)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151 | {
| ~
152 | unsigned int _Marker;
| ~~~~~~~~~~~~~~~~~~~~~
153 | if (_Memory)
| ~~~~~~~~~~~~
154 | {
| ~
155 | _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156 | _Marker = *(unsigned int*)_Memory;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157 | if (_Marker == _ALLOCA_S_HEAP_MARKER)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 | {
| ~
159 | free(_Memory);
| ~~~~~~~~~~~~~~
160 | }
| ~
161 | #ifdef _ASSERTE
| ~~~~~~~~~~~~~~~
162 | else if (_Marker != _ALLOCA_S_STACK_MARKER)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 | {
| ~
164 | _ASSERTE(("Corrupted pointer passed to _freea" && 0));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165 | }
| ~
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\malloc.h:150:29: note: but in '' found a different body
150 | __inline void __CRTDECL _freea(_Pre_maybenull_ _Post_invalid_ void* _Memory)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151 | {
| ~
152 | unsigned int _Marker;
| ~~~~~~~~~~~~~~~~~~~~~
153 | if (_Memory)
| ~~~~~~~~~~~~
154 | {
| ~
155 | _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156 | _Marker = *(unsigned int*)_Memory;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157 | if (_Marker == _ALLOCA_S_HEAP_MARKER)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 | {
| ~
159 | free(_Memory);
| ~~~~~~~~~~~~~~
160 | }
| ~
161 | #ifdef _ASSERTE
| ~~~~~~~~~~~~~~~
162 | else if (_Marker != _ALLOCA_S_STACK_MARKER)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 | {
| ~
164 | _ASSERTE(("Corrupted pointer passed to _freea" && 0));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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