Very uncommon syntax errror

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am using gcc version 3.3.1 under cygwin.
the following code produces a syntax error during compilation,
witch has no obvious reason for me.

#include <vector>

enum ids
{
  NONE,
  INT,
  TUPLE,
};

template<int id, int el_id = NONE> struct type;

template<>
struct type<NONE>
{
};

template<int id, typename T, int el_id = NONE>
struct base
{
  typedef T data_type;
};

template<>
struct type<INT> : base<INT, int>
{
};

template<int el_id>
struct type<TUPLE, el_id> : base<TUPLE, std::vector< type<INT> >, el_id>
{
  data_type::const_iterator cit;  // syntax error before ';' token
};

int main(void)
{
  return 0;
}

Both Intel C++ 7.1 and Microsoft VC .NET compile this code.

If I replace the line :
struct type<TUPLE, el_id> : base<TUPLE, std::vector< type<INT> >, el_id>
with:
struct type<TUPLE, el_id> : base<TUPLE, std::vector< type<INT> >, NONE>
gcc does compile without errors.

Best regards,
 Dirk


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux