llvm / llvm/llvm-project

type aware allocators don't match allocation functions with default template parameters

Open
#182,708 1 comment 0 reactions 1 assignee Claimed by @ojhunt View on GitHub
clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

While messing around with source_location defaults I found that the type aware allocation function resolution does not correctly handle default parameters:

```cpp
using size_t = __SIZE_TYPE__;

namespace std {
template struct type_identity{};
enum class align_val_t: size_t;
}
struct S {
template void *operator new(std::type_identity, size_t, std::align_val_t, T) {
static char buffer[20];
return buffer;
};
template void operator delete(std::type_identity, void*, size_t, std::align_val_t, T) {

};
};

int main(int, const char**) {
new S;
return 0;
}
```

Fails to resolve `S::operator new`, time to work out why

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.