<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60202>60202</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20][Modules] Includes in module partitions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SasisaDev
      </td>
    </tr>
</table>

<pre>
    ```c++
module;

#include <cstdlib>

export module Types:Allocator;

export
template <typename ElementType>
class TAllocator {
public:
    static ElementType* Allocate(unsigned int sz) {
        return malloc(sz);
 }
};
```
```c++
export module Types;

export impot :Allocator;
```
```
error: use of undeclared identifier 'malloc'; did you mean '_alloca'?
    return malloc(sz);
           ^~~~~~
 _alloca
```
If i move this implementation to main module, and not it's partition, code compiles.
If i use this code with other simmiliar modules, and they cross at some point, error becomes bigger.
```haskell
In file included from D:\VisualStudio\VC\Tools\MSVC\14.34.31933\include\cstdlib:12:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\math.h:11:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:16:1: error: unknown type name '_UCRT_DISABLE_CLANG_WARNINGS'
_UCRT_DISABLE_CLANG_WARNINGS
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:18:20: error: expected ';' after top level declarator
_CRT_BEGIN_C_HEADER
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:175:26: error: unknown type name '_In_'
void __cdecl _fperrraise(_In_ int _Except);
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:177:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP short __cdecl _dclass(_In_ double _X);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:177:24: error: expected ';' after top level declarator
_Check_return_ _ACRTIMP short __cdecl _dclass(_In_ double _X);
                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:177:47: error: unknown type name '_In_'
_Check_return_ _ACRTIMP short __cdecl _dclass(_In_ double _X);
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:178:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP short __cdecl _ldclass(_In_ long double _X);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:178:24: error: expected ';' after top level declarator
_Check_return_ _ACRTIMP short __cdecl _ldclass(_In_ long double _X);
                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:178:48: error: unknown type name '_In_'
_Check_return_ _ACRTIMP short __cdecl _ldclass(_In_ long double _X);
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:179:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP short __cdecl _fdclass(_In_ float _X);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:179:24: error: expected ';' after top level declarator
_Check_return_ _ACRTIMP short __cdecl _fdclass(_In_ float _X);
                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:179:48: error: unknown type name '_In_'
_Check_return_ _ACRTIMP short __cdecl _fdclass(_In_ float _X);
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:181:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP int __cdecl _dsign(_In_ double _X);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:181:24: error: expected ';' after top level declarator
_Check_return_ _ACRTIMP int __cdecl _dsign(_In_ double _X);
                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:181:44: error: unknown type name '_In_'
_Check_return_ _ACRTIMP int __cdecl _dsign(_In_ double _X);
 ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:182:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP int __cdecl _ldsign(_In_ long double _X);
^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:182:24: error: expected ';' after top level declarator
_Check_return_ _ACRTIMP int __cdecl _ldsign(_In_ long double _X);
                       ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:182:45: error: unknown type name '_In_'
_Check_return_ _ACRTIMP int __cdecl _ldsign(_In_ long double _X);
                                            ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h:183:1: error: unknown type name '_Check_return_'
_Check_return_ _ACRTIMP int __cdecl _fdsign(_In_ float _X);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWU-P4rgT_TTmUmqUOAkJBw4QYH7oN9Madffu7C0ySQW849iR7fSfPexnXzkJMLR6ZxnNQGMhuo3LVX7P9SrGMGP4RiJOSDQj0XzAGrtVenLPDDdsjo-DtSpeJmTkda-c0Jl7eXPiTStVNAJJ0Hf7dxpwmYumQCBBmhtbCL4mweJbG3yulbbQzYeHlxoNCaZTIVTOrNKvPHbW3f8Wq1ow2_q2LzVKViEsBFYorfOzD5QLZgw87H0CiXundbMWPCdB7x0AwFhmeX7kh06hn4uEJo1sWSqASwvmL0LHB3_QN4220RIq5qYRmrRmeyhA4nkPKp4fAO54fdU9ovlNtt5gCHhVKwtvM_kvgfr5WjvbKTQGQZXQyAJzwbQDXKC0vOSogdB4By4mwQwKXsCLaqBCJt1g1g6ydnR54OY_eDk0Ei3-dq0f2Ll7a8GrEjhU6hHBbrlxwL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