Problem with STL set on Solaris 2.7 SC 5.0 compilers

Problem with STL set on Solaris 2.7 SC 5.0 compilers

Post by Raikanta Sa » Sat, 10 Mar 2001 06:36:54



Hi there.

We are having trouble using the STL set on Solaris 2.7 with the SC 5.0
compilers.

We are not able to create an STL set as a member data of one of our own
template classes. Listed below are:

  * The contents of the C++ file
  * The compiler commands and the error messages using both the
    STLPort 4.0 from SGI and the RogueWave STL files that come with
    the SC5.0 native compiler on Solaris 2.7.

If you can identify the problem and let us know what is wrong with what we
are doing, we would appreciate it.

Thanks a ton in advance.

/***************** BEGIN CODE *****************************/

#include <set>
using namespace std;

template <class T>
class MyTemplateClass
{
   public :

      MyTemplateClass() ;
      //- Default constructor

      ~MyTemplateClass() { clear(); }
      //- Destructor

      void clear() ;
      //- This function clears the entire set.

   private :

      set<T> theSet_ ;
      //- my set

};

template<class T>
MyTemplateClass<T>::MyTemplateClass()
{

}

template<class T>
void MyTemplateClass<T>::clear()
{
   theSet_.clear();

}

void f()
{
   // This line compiles without error.
   set<int> aSet;

   // This line does not compile
   MyTemplateClass<int> aTemplate;

   return;

}

/********************** END CODE *************************/

/********************** BEGIN COMPILER ERROR *************/

/** ERROR with using the STLPort 4.0 version from SGI ***/

Command:

CC -I/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5 -c temp.C

Error Messages:

"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 55: Error: pointer is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 56: Error: const_pointer is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 57: Error: reference is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 58: Error: const_reference is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 59: Error: const_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 61: Error: const_reverse_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 62: Error: const_reverse_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 63: Error: size_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 64: Error: difference_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 65: Error: allocator_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 68: Error: The type "_STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>" is incomplete.
"temp.C", line 111:     Where: While specializing "_STL::set<int>".
"temp.C", line 111:     Where: Specialized in non-template code.
"temp.C", line 111: Error: Cannot assign _STL::set<int, _STL::less<int>, _STL::allocator<int>>* to _STL::set<int>*.
12 Error(s) detected.
/export/home/common/goma/developer/mjpanth/work_dir/cedge/common/source/Misc/source>>CC -I/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5 -c temp.C
"temp.C", line 13: Error: Type name expected instead of "MyTemplateClass1".
"temp.C", line 42:     Where: While specializing "MyTemplateClass<int>".
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 55: Error: pointer is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 56: Error: const_pointer is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 57: Error: reference is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 58: Error: const_reference is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 59: Error: const_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 61: Error: const_reverse_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 62: Error: const_reverse_iterator is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 63: Error: size_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 64: Error: difference_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 65: Error: allocator_type is not a member of _STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
"/export/home/mjpanth/STL/SGI-STL/STLport-4.0/stlport/SC5/stl/_set.h", line 68: Error: The type "_STL::_Rb_tree<int, int, _STL::_Identity<int>, _STL::_Compare, _STL::_Alloc>" is incomplete.
"temp.C", line 21:     Where: While specializing "_STL::set<int>".
"temp.C", line 21:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 42:     Where: Specialized in non-template code.
12 Error(s) detected.

/********************** END COMPILER ERROR *************/

/********************** BEGIN COMPILER ERROR *************/

/** ERROR with using the RogueWave STL files distributed with the native
compiler - SC 5.0 on the Solaris 2.7  ***/

Command:

CC -c temp.C

Error Messages:

"temp.C", line 15: Error: Type name expected instead of "MyTemplateClass1".
"temp.C", line 44:     Where: While specializing "MyTemplateClass<int>".
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 112: Error: The type "__rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>" is incomplete.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 118: Error: reference is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 119: Error: const_reference is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 120: Error: iterator is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 121: Error: const_iterator is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 122: Error: size_type is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 123: Error: difference_type is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 124: Error: pointer is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 125: Error: const_pointer is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 126: Error: reverse_iterator is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
"/usr/local/SUNWspro/SC5.0/include/CC/./set", line 127: Error: const_reverse_iterator is not a member of __rwstd::__rb_tree<int, int, __rwstd::__ident<int, int>, std::Compare, std::Allocator>.
"temp.C", line 23:     Where: While specializing "std::set<int>".
"temp.C", line 23:     Where: Specialized in MyTemplateClass<int>.
"temp.C", line 44:     Where: Specialized in non-template code.
12 Error(s) detected.

/********************** END COMPILER ERROR *************/

-Raikanta

+----------------------------------------------+--------------------------+
| Raikanta Sahu                                | phone: (505) 277-8332    |
| rs...@unm.edu                                | FAX  : (505) 277-8235    |
+----------------------------------------------+--------------------------+
| Research Staff                               | 1601 Central Ave NE      |
| Albuquerque High Performance Computing Center| University of New Mexico |
| University of New Mexico                     | Albuquerque, NM 87131    |
+----------------------------------------------+--------------------------+

 
 
 

1. SC 5.0 compiler

Hi,

I know, that's not a newsgroup for SC compiler bug reports, but
I haven't found one.

OK, I have tried to compile the following piece of code
on a Sparc Ultra 10 (SunOS 5.6) with SC 5.0:

---8<------------------------------------------------------------
#include <list>
using namespace std;

template <class TA> class A { TA _value; };

template <class TB> class B : public A<list<TB> > {};

main (int argc, char **argv)
{
  B<int> foo;
---8<------------------------------------------------------------        

but all I got was:

---8<------------------------------------------------------------
"SCbug.cpp", line 134: Error: The type "__rwstd::__rw_basis<int,
std::Allocator>" is incomplete.
"SCbug.cpp", line 4:     Where: While specializing "std::list<int>".
"SCbug.cpp", line 4:     Where: Specialized in A<std::list<int>>.
"SCbug.cpp", line 6:     Where: Specialized in B<int>.
"SCbug.cpp", line 10:     Where: Specialized in non-template code.
1 Error(s) detected.
---8<------------------------------------------------------------        

I can compile the same piece with gcc2.8.1, NCC 7.2 on IRIX, and
VC 5.0 so I belief it's correct C++.

Is it really a compiler bug ? I tried the STLport stl impl.
instead of the sun stl impl. with the same result.

Any Idea ?
  Johannes

2. bbs

3. Newbie: Solaris 2.7 compiler

4. how to reformat?

5. egcs C++ compiler with STL library, how on redhat 5.0?

6. what do they look for

7. Internet Explorer 5.0 on Solaris 2.7 Sparc

8. (none)

9. ostream::operator<< deadlocks in MT environment under Sun's C++ 5.0 / Solaris 2.7

10. setting up .rhosts file on Sun Solaris 2.7

11. Setting modem and ppp on Solaris 2.7

12. When will Solaris Sun C++ compiler support STL ?

13. Error in linknig C++ STL code using CC 5.0 on Solaris 2.6