https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79706
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #1) > Probably the same issue: > > struct A { > void operator delete(void*) = delete; > void operator delete[](void*) = delete; > }; > > using type1 = decltype(delete (A*)0); > using type2 = decltype(delete[] (A*)0); > > Neither of these invalid delete expressions gives an error. Hmm, according to [expr.delete]/7.3 (https://eel.is/c++draft/expr.delete#7.3): If the value of the operand of the delete-expression is a null pointer value, it is unspecified whether a deallocation function will be called as described above. So I suppose we're not wrong to accept the above delete expressions? If we use a non-zero pointer constant instead, then we do give an error for this testcase: 79706-2.C:6:35: error: use of deleted function ‘static void A::operator delete(void*)’ 6 | using type1 = decltype(delete (A*)16); | ^~ 79706-2.C:2:8: note: declared here 2 | void operator delete(void*) = delete; | ^~~~~~~~ 79706-2.C:7:37: error: use of deleted function ‘static void A::operator delete [](void*)’ 7 | using type2 = decltype(delete[] (A*)16); | ^~ 79706-2.C:3:8: note: declared here 3 | void operator delete[](void*) = delete; | ^~~~~~~~