[expr.delete] / 1:
The operand must have a pointer to an object type or class type. If the type is a class, the operand is implicitly converted to a context (point [conv]) by a pointer to the type of object.
[conv] / 5, my emphasis is:
Some language constructs require conversion to a value that has one specific set of types that correspond to the construct. an expression e type e that appears in such a context for context-indirect conversion to a given type T and is correctly formed if and only if e can be implicitly converted to type T , which is defined as follows: e searches for an implicit conversion function, type returning cv T or a reference to cv T such that T resolved by context. There must be exactly one such T
There are two such T in your code ( int * and const int * ). Therefore, it is poorly formed before you even go to resolution.
Note that in this area there are changes between C ++ 11 and C ++ 14. C ++ 11 [expr.delete] / 1-2 says
The operand must have a pointer to an object type or class type with one implicit conversion function (12.3.2) to an object type pointer. [...]
If the operand is of type class, the operand is converted to a pointer type, calling the above conversion function, [...]
What if you read literally, resolve your code and always call operator const int*() const , because int* & is a reference type, not a pointer to an object type. In practice, implementations look at conversion functions for a "reference to an object pointer", for example, operator int*&() , and then reject the code because it has more than one qualifying implicit conversion function.
source share