This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++/3309: 'string' typedef bug


> #include <string>
> 
> 
> class Test
> {
>   public:
> 
>   typedef int IntType;
>   typedef string StringType;
> };
> 
>test.cxx:11: ISO C++ forbids declaration of `string' with no type
>test.cxx:11: parse error before `;' token

This is not a bug, though the error message is
somewhat misleading. Gcc 3.0 is much closer 
to c++ standard then 2.95, so <string> header 
does not define class string in the global 
namespace anymore.

Either write 
    typedef std::string StringType;
or
    using std::string; // just after including <string>





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]