public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Very uncommon syntax errror
@ 2004-01-13 20:13 Dirk Sonnemann
  2004-01-13 20:30 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Dirk Sonnemann @ 2004-01-13 20:13 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Very uncommon syntax errror
  2004-01-13 20:13 Very uncommon syntax errror Dirk Sonnemann
@ 2004-01-13 20:30 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2004-01-13 20:30 UTC (permalink / raw)
  To: Dirk Sonnemann, gcc-help

Hi Dirk,

Try this...

template<int el_id>
struct type<TUPLE, el_id> : base<TUPLE, std::vector< type<INT> >, el_id>
{
  typename data_type::const_iterator cit;  // No more error :-)
};

HTH,
--Eljay


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-13 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13 20:13 Very uncommon syntax errror Dirk Sonnemann
2004-01-13 20:30 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).