Issue |
90620
|
Summary |
[C++20] [Modules] Cannot export type_info/operator new/operator delete
|
Labels |
new issue
|
Assignees |
|
Reporter |
huangqinjin
|
#### `test.cppm`
```c++
module;
#include <stddef.h>
export module test;
extern "C++"
{
export class type_info; // 0
export void* operator new(size_t); // 1
export void* operator new[](size_t); // 2
export void operator delete(void*) noexcept; // 3
export void operator delete[](void*) noexcept; // 4
export void operator delete(void*, size_t) noexcept; // 5
export void operator delete[](void*, size_t) noexcept; // 6
}
```
#### targeting x86_64-linux-gnu
```shell
✗ clang --target=x86_64-linux-gnu -std=c++20 --precompile test.cppm
test.cppm:11:18: error: cannot export redeclaration 'operator new' here since the previous declaration is not exported
11 | export void* operator new(size_t); // 1
| ^
note: previous declaration is here
test.cppm:12:18: error: cannot export redeclaration 'operator new[]' here since the previous declaration is not exported
12 | export void* operator new[](size_t); // 2
| ^
note: previous declaration is here
test.cppm:13:17: error: cannot export redeclaration 'operator delete' here since the previous declaration is not exported
13 | export void operator delete(void*) noexcept; // 3
| ^
note: previous declaration is here
test.cppm:14:17: error: cannot export redeclaration 'operator delete[]' here since the previous declaration is not exported
14 | export void operator delete[](void*) noexcept; // 4
| ^
note: previous declaration is here
4 errors generated.
```
#### targeting x86_64-windows-msvc
```shell
✗ clang --target=x86_64-windows-msvc -std=c++20 --precompile test.cppm
test.cppm:9:18: error: cannot export redeclaration 'type_info' here since the previous declaration is not exported
9 | export class type_info; // 0
| ^
note: previous declaration is here
test.cppm:11:18: error: cannot export redeclaration 'operator new' here since the previous declaration is not exported
11 | export void* operator new(size_t); // 1
| ^
note: previous declaration is here
test.cppm:12:18: error: cannot export redeclaration 'operator new[]' here since the previous declaration is not exported
12 | export void* operator new[](size_t); // 2
| ^
note: previous declaration is here
test.cppm:13:17: error: cannot export redeclaration 'operator delete' here since the previous declaration is not exported
13 | export void operator delete(void*) noexcept; // 3
| ^
note: previous declaration is here
test.cppm:14:17: error: cannot export redeclaration 'operator delete[]' here since the previous declaration is not exported
14 | export void operator delete[](void*) noexcept; // 4
| ^
note: previous declaration is here
5 errors generated.
```
The strange thing is that other overloads of `operator new` and `operator delete` can be exported without error.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs