You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@stdcxx.apache.org by Dipak Bapatla <de...@sbcglobal.net> on 2006/02/16 00:11:34 UTC

Incomplete types - compilation problem

Hi,
   
  I am trying to use Boost built using stdcxx on Solaris. I was able to build the date_time library but when I try to compile a test program I end up with errors related to incomplete types. I have narrowed the issue to the following code
   
  #include <map>
#include <string>
  using namespace std;
  template <class T>
struct C {
     typedef multimap<T,C> maps;
     typedef typename maps::value_type value_type;
};
   
  int main () {
  C<std::string> c;
}

  When I compile using the default Sun CC libraries or rwtools7_std or stlport4, the code compiles fine. But when I compile using stdcxx, I end up with the following errors.
   
  "/opt/idev3/dbapatla/apache-stdcxx-4.1.3/include/rw/_pair.h", line 55: Error: In this declaration "second" is of an incomplete type "C<std::string>".
"/opt/idev3/dbapatla/apache-stdcxx-4.1.3/include/rw/_tree.h", line 86:     Where: While specializing "std::pair<const std::string, C<std::string>>".
"/opt/idev3/dbapatla/apache-stdcxx-4.1.3/include/rw/_tree.h", line 86:     Where: Specialized in __rw::__rw_rb_tree_node<std::allocator<std::pair<const std::string, C<std::string>>>, std::pair<const std::string, C<std::string>>, std::string, __rw::__select1st<std::pair<const std::string, C<std::string>>, std::string>>.
"/opt/idev3/dbapatla/apache-stdcxx-4.1.3/include/rw/_tree.h", line 259:     Where: Specialized in __rw::__rb_tree<std::string, std::pair<const std::string, C<std::string>>, __rw::__select1st<std::pair<const std::string, C<std::string>>, std::string>, std::less<std::string>, std::allocator<std::pair<const std::string, C<std::string>>>>.
"/opt/idev3/dbapatla/apache-stdcxx-4.1.3/include/map", line 323:     Where: Specialized in std::multimap<std::string, C<std::string>, std::less<std::string>, std::allocator<std::pair<const std::string, C<std::string>>>>.
"test2.cpp", line 9:     Where: Specialized in C<std::string>.
"test2.cpp", line 13:     Where: Specialized in non-template code.
1 Error(s) detected.


Re: Incomplete types - compilation problem

Posted by Martin Sebor <se...@roguewave.com>.
I created STDCXX-152 to keep track of this enhancement:
   http://issues.apache.org/jira/browse/STDCXX-152

Martin

Martin Sebor wrote:
> Dipak Bapatla wrote:
> 
>> Hi,
>>      I am trying to use Boost built using stdcxx on Solaris. I was 
>> able to
>> build the date_time library but when I try to compile a test program I
>> end up with errors related to incomplete types. I have narrowed the
>> issue to the following code
>>      #include <map>
>> #include <string>
>>   using namespace std;
>>   template <class T>
>> struct C {
>>      typedef multimap<T,C> maps;
>>      typedef typename maps::value_type value_type;
> 
> 
> All containers require that their element types be complete types.
> Except in the bodies of its member functions (and a few other cases)
> a class is considered a complete type after the closing curly bracket.
> So the above is undefined.
> 
> We have an enhancement request in our (Rogue Wave) database to allow
> incomplete types in some of our containers (in particular in map) but
> the enhancement is not implemented yet. Let me add your case to the
> issue.
> 
> Martin


Re: Incomplete types - compilation problem

Posted by Martin Sebor <se...@roguewave.com>.
Dipak Bapatla wrote:
> Hi,
>    
>   I am trying to use Boost built using stdcxx on Solaris. I was able to
> build the date_time library but when I try to compile a test program I
> end up with errors related to incomplete types. I have narrowed the
> issue to the following code
>    
>   #include <map>
> #include <string>
>   using namespace std;
>   template <class T>
> struct C {
>      typedef multimap<T,C> maps;
>      typedef typename maps::value_type value_type;

All containers require that their element types be complete types.
Except in the bodies of its member functions (and a few other cases)
a class is considered a complete type after the closing curly bracket.
So the above is undefined.

We have an enhancement request in our (Rogue Wave) database to allow
incomplete types in some of our containers (in particular in map) but
the enhancement is not implemented yet. Let me add your case to the
issue.

Martin