GCC fails to compile the following example, because it isn't generating all of the necessary built-in candidates for operator== and operator-:
struct VolatileIntPtr { operator int volatile *(); }; struct ConstIntPtr { operator int const *(); }; void test_with_ptrs(VolatileIntPtr vip, ConstIntPtr cip) { bool b1 = (vip == cip); long p1 = vip - cip; } Note that in the (first) error message: /Users/dgregor/op.cpp: In function void test_with_ptrs(VolatileIntPtr, ConstIntPtr): /Users/dgregor/op.cpp:10: error: no match for operator== in vip == cip /Users/dgregor/op.cpp:10: note: candidates are: operator==(const int*, const int*) <built-in> /Users/dgregor/op.cpp:10: note: operator==(volatile int*, volatile int*) <built-in> we're missing the built-in candidate operator==(const volatile int*, const volatile int*) that would be picked. -- Summary: Missing some built-in candidates for operator overloading Product: gcc Version: 4.0.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: doug dot gregor at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38174