Quuxplusone / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
https://p1144.godbolt.org/z/jf67zx5hq
Other
1 stars 2 forks source link

Member `operator new` and `operator delete` should reject explicit object parameters #18

Closed Quuxplusone closed 9 months ago

Quuxplusone commented 1 year ago

("Deducing this" implementation progress is being tracked in https://github.com/llvm/llvm-project/issues/59619 )

Even after 20d97adfd3e9ba305bf23b13749e2ae0af1069b0 and 82a32140acb52472241f04644cdcf88a4cf4bee8, the following program is still incorrectly accepted: https://godbolt.org/z/MaTnqsaEv

#include <new>
#include <memory>

struct S {
    void *operator new(this unsigned long);
    void operator delete(this void*);
    void operator delete(this S*, std::destroying_delete_t);
};

These functions are members, but they are implicitly static members ([class.free/3]), which means they shouldn't be allowed to have explicit object parameters.

Quuxplusone commented 1 year ago

This is addressed on the paper-standard-wording side by https://cplusplus.github.io/CWG/issues/2553.html .

Quuxplusone commented 9 months ago

Merged f7c2e5fa05d221a3dfc53744f353517407c2ffec! 🎉