Issue 60202
Summary [C++20][Modules] Includes in module partitions
Labels
Assignees
Reporter SasisaDev
    ```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.
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to