Advertisement

strange c++ compile error on gcc

Started by November 07, 2005 01:34 PM
0 comments, last by Cocalus 19 years ago
Hi! I have been a VC++ developer for quite some time, and recently tried compiling some stuff on Linux. now i've stumbled across a strange compile error (using GCC 3.3.5):

struct IParameterAccessor
{
...
};

template <size_t i>
class test
{
public:
typedef std::pair < std::string, IParameterAccessor* >  TParamPair;

void func(const char* s, IParameterAccessor* a)
{
// *** compile error thrown in this line:
TParamPair p(std::string(s), a);

/* BUT: The following commented line works: */
//   std::pair<std::string, IParameterAccessor*> p(std::string(s), a);
/* AND: The next commented lines works as well: */
//   TParamPair p;
//   p.first = std::string(s);
//   p.second = p;
}
};


why is that so? whats wrong? help please! greets
try changing
TParamPair p(std::string(s), a);
to
typename TParamPair p(std::string(s), a);

GCC is right by the standard (at least if the book I just read is correct).

This topic is closed to new replies.

Advertisement