public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Possible g++ compilation problem.
@ 2004-08-12 16:49 R. Clayton
  2004-08-16 21:42 ` James E Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: R. Clayton @ 2004-08-12 16:49 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]

  $ uname -a
  Linux hope 2.4.22-openmosix3 #1 Wed Apr 14 04:36:24 CEST 2004 i686 i686 i386
  GNU/Linux

  $ g++ -v
  Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
  Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
  --infodir=/usr/share/info --enable-shared --enable-threads=posix
  --disable-checking --disable-libunwind-exceptions --with-system-zlib
  --enable-__cxa_atexit --host=i386-redhat-linux 
  Thread model: posix
  gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

  $ cat junk.cc
  struct ast_node {
    template < typename T >
    T get_child() {
      return 0;
      }
    };

  template < typename T >
  void f(T x, ast_node n) {
    n.get_child<int>();
    }

  $ g++ -c junk.cc
  junk.cc: In function `void f(T, ast_node)':
  junk.cc:10: error: syntax error before `>' token

  $ 

and also

  $ uname -a
  SunOS clayton 5.9 Generic_112233-06 sun4u sparc

  $ g++ -v
  Reading specs from
  /usr/local2/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/specs 
  Configured with: ./configure --prefix=/usr/local2/stow/gcc-3.3.2
  Thread model: posix
  gcc version 3.3.2

  $ g++ -c junk.cc
  junk.cc: In function `void f(T, ast_node)':
  junk.cc:10: error: parse error before `>' token

  $ 

The Forte and Comeau C++ compilers compile this code without errors.

[-- Attachment #2: junk.cc --]
[-- Type: application/octet-stream, Size: 164 bytes --]

struct ast_node {
  template < typename T >
  T get_child() {
    return 0;
    }
  };

template < typename T >
void f(T x, ast_node n) {
  n.get_child<int>();
  }

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

* Re: Possible g++ compilation problem.
  2004-08-12 16:49 Possible g++ compilation problem R. Clayton
@ 2004-08-16 21:42 ` James E Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: James E Wilson @ 2004-08-16 21:42 UTC (permalink / raw)
  To: R. Clayton; +Cc: gcc-bugs

R. Clayton wrote:
>   $ g++ -c junk.cc
>   junk.cc: In function `void f(T, ast_node)':
>   junk.cc:10: error: syntax error before `>' token

I tried gcc-3.4.  It compiles without complaint, so apparently this is 
already fixed.  gcc-3.4 has rewritten C++ parser, and this fixed many 
C++ parsing problems with gcc-3.3 and earlier.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

end of thread, other threads:[~2004-08-16 21:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-12 16:49 Possible g++ compilation problem R. Clayton
2004-08-16 21:42 ` James E Wilson

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).