Issue |
98889
|
Summary |
clang misses useful diagnostic for private `operator delete` in template base class
|
Labels |
clang
|
Assignees |
|
Reporter |
Rush10233
|
Consider the following code:
```c++
template <typename T>struct QCachedT{
void operator delete(void *, T *) {}
};
struct thing_t :private QCachedT<int>{
};
int main() {
auto thing=new thing_t;
//error
//delete thing_t;
}
```
Clang will not report any error for the private `delete` operator until it is explicitly called. That seems inappropriate because clang will error immediately after using the `new` operator if the base class `QCachedT` is non-template instead. As a comparison, GCC always provides an error right after the `new` statement is created no matter whether `QCachedT` is a template class or not.
[https://godbolt.org/z/r71e3WT5h](https://godbolt.org/z/r71e3WT5h)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs