This section describes operator-related limitations and issues as well as unsupported operator features.
- struct A { }; void operator*(A) { counter++; } enum B{ }; int operator*(B) { return 0; } -------------------^-----Function differs in return type only (found 'void ' expected 'int ') - struct A{ operator int*(){return &global;} } A a; (void)*a; --------^----------------Compile ERROR - struct A{}; struct B:struct A{}; int operator*(A) {return 1;} int f() { B b; return (*b); -----------------^----------------Illegal cast operation } - int operator->*(B,int){ return 1; } ----------------^------ERROR: unary operator must have one parameter
struct A { void operator*() { } void test(); }; void operator*(S, int) { } // not hidden by S::operator*() void S::test(){ S s; (void) (s * 3); --------------^------------------Compile ERROR
struct B { operator int() { return 1; } }; B b; b.operator int(); -------------^-------------ERROR: Not supported explicit operator call