[C++] Template inheritence problem

From: Garrett Kajmowicz (gkajmowi_at_tbaytel.net)
Date: 07/25/04


Date: Sat, 24 Jul 2004 22:42:27 -0400

I'm working on (slowly) implementing the standard library, with a few
modifications.

I've defined basic string as follows:

#include <memory>
#include <vector>
#include <exception>
template<class Ch, class Tr = char_traits<Ch>, class A =
allocator<Ch> > class basic_string
        : public vector<Ch, A>
{

//...

}

But my compiler is giving me an error:

filename error: base class `std::vector<char, std::allocator<char> >'
   has incomplete type
../include/string: In constructor `std::basic_string<Ch, Tr,
   A>::basic_string(const A&) [with Ch = char, Tr =
   std::char_traits<char>, A = std::allocator<char>]':

   instantiated from here ../include/string:69: error: type
`struct std::vector<char,
   std::allocator<char> >' is not a direct base of
   `std::basic_string<char, std::char_traits<char>, std::allocator<char> >'

Is there something that I am missing, or have I found (yet another)
compiler bug? (GCC 3.3.4) I have no problems creating a std::vector<char,
std::allocator<char> > in an application.

Thanks for the help.

- Garrett Kajmowicz



Relevant Pages

  • Re: Problems Building Bluetooth with K6 and CONFIG_REGPARM
    ... >>Hi Andy, ... > Sounds like a compiler bug, especially since changing the CPU type fixes ... I was using Debian's GCC 4.0.1-6. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: memset() implement for T2+ vs UltraSPARC processors.
    ... It would appear to be a gcc compiler bug, but is only seen on T2+ ... The mpfr guys are pretty convinced it is compiler bug in gcc, and whilst a workaround has been developed, they don't want to apply it to MPFR, as it will slow the code somewhat. ... 'Experts Exchange' take questions posted on the web and try to find ...
    (comp.unix.solaris)
  • Re: stdout not open?
    ... I can invoke gcc like so: ... and foo will work as expected. ... As near as I can figure, FILE* points to a struct which ... I'm leaning towards compiler bug, simply because your code has no structs. ...
    (comp.lang.c)
  • Re: {put,get}_user() side effects
    ... >> Neither typeof not sizeof are supposed to have side effects. ... >> compiler generates them that's a compiler bug. ... Maybe gcc gets it wrong, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [PATCH][2.6.8-rc1-mm1] drivers/scsi/sg.c gcc341 inlining fix
    ... gcc isn't properly inlining functions where uses occur ... Or you could just call it "gcc is dumb" rather than a compiler bug. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)