Issue 56027
Summary Compile error for void* return type with 32-bit pointer address space
Labels new issue
Assignees
Reporter ararmine
    Clang emits a compile error void * return type and void * parameter, when 32-bit pointer attribute is specified. 

Steps to reproduce:
1. test.cpp

```
extern "C" void *malloc(size_t);

void * __ptr32 operator new[](size_t t, int foo) {
    return malloc(t);
}

void operator delete[](void * __ptr32, int) {}

class node {
    public:
        node() {};
};


int main()
{
    node* __ptr32 n3;
    n3 = new(3) node[3];
}

```

2. running command
clang test.cpp -S -target x86_64-windows-msvc -fms-extensions

Output:
```
test.cpp:7:16: error: 'operator new[]' must return type 'void *'
void * __ptr32 operator new[](size_t t, int foo) {
               ^
test.cpp:11:6: error: first parameter of 'operator delete[]' must have type 'void *'
void operator delete[](void * __ptr32, int) {}
```
clang version - 14.0.0
Test case is compiled successfully with x86-64 msvc v.19.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to