stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dipak Bapatla <>
Subject Re: Errors compiling examples - Sun studio 11
Date Tue, 14 Feb 2006 19:59:04 GMT
I have changed the code as follows in the two definitions in _tree.h to get the examples to
      const_iterator _C_make_iter (const _C_link_t __node) const {
        return const_iterator (*this, _C_tree_citer (__node));

      const_iterator _C_make_iter (_C_link_t __node) const {
        return const_iterator (*this, _C_tree_citer (__node));

 Removed the const from the parameter type. 
  It is weird that the compiler complained about the code because I have the test program
below and it works fine as expected.
  #include <iostream>

  class Hello {
   int num(int a) { return 1; };
   int num(const int a) const { return 3; }
  int main(int argc, char** argv)
  Hello a;
  const Hello b = a;
  int k=3;
  std::cout << a.num(k) << std::endl;
  std::cout << b.num(k) << std::endl;

  macms01$ ./testit
  Martin Sebor <> wrote:
  Dipak Bapatla wrote:
> CC: Sun C++ 5.8 Patch 121017-01 2005/12/11

So it looks like we have the vanilla 5.8 and you are have a patched
version of the same. I don't think I can get this version installed
here anytime soon to reduce the error to a small enough test case
to put together and test a workaround for you but I can suggest one.

Rename the const overload of _C_make_iter to _C_make_const_iter (or
something similarly unique), and replace all calls to it (i.e., all
calls from other __rw_tree const member functions) with those to the
renamed function.


> Martin Sebor wrote: Dipak Bapatla wrote:
>>The same error shows up with around three or four examples. 
> The error is obviously bogus. It says there is an ambiguity between
> __rb_tree::_C_make_iter (__rw_rb_tree_node*)
> and
> __rb_tree::_C_make_iter (const __rw_rb_tree_node*) const
> There is no ambiguity between the two and I'm not seeing any errors
> in my build. What exactly is the CC version you are using? Mine is
> $ CC -V
> CC: Sun C++ 5.8 2005/10/13
> Martin


  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message