Topic: Recursive application of operator -> & overload resolution


Author: h.grund@ixtraclick.net ("Holger Grund")
Date: Tue, 22 Apr 2003 19:34:18 +0000 (UTC)
Raw View
Can someone see a reason why the following does not compile
under Comeau. I feel VC is right to accept the code since
the class member access operator is subject to overload
resolution just like any other function.
In particular, 13.3.3.2/3 seems to apply:

<snip>
- Standard conversion sequence S1 is a better conversion
sequence than standard conversion sequence S2 if
[...]
S1 and S2 differ only in their qualification conversion and
yield similair types T1 and T2 (4.4), respectively, and the
cv-qualification signature of type T1 is a proper subset of
the cv-qualification of type T2
</snip>

struct foo{};

struct X
{
 volatile X& operator->()
 {
  return *this;
 }

 foo* operator->() volatile
 {
  return 0;
 }
};

int main()
{
 X x;
 x->~foo();
}

error: loop in sequence of "operator->" functions starting
          at class "X"
   x->~foo();

tia
-hg



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]