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]
Other format: [Raw text]

template problem in gcc with --pedantic-errors

[Get raw message]
Hello,

I get an odd parse error when compiling some template code with the 
--pedantic-errors switch. Without this switch it compiles without 
errors. I have tried this with both gcc 2.96 and 3.0.1. It compiles 
without errors in Visual C++.

Here is my command line and gcc's output (source code and preprocessed 
file attached):

astmatix <28> gcc -v -save-temps --pedantic-errors fultest.cpp -o fultest
Reading specs from 
/sw/gcc-3.0.1/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/specs
Configured with: ../gcc-3.0.1/configure --prefix=/sw/gcc-3.0.1 
--enable-shared --enable-cpp
Thread model: posix
gcc version 3.0.1
  /sw/gcc-3.0.1/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/cpp0 -lang-c++ 
-D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 
-v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=1 -Dsparc -Dsun 
-Dunix -D__svr4__ -D__SVR4
-D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun 
-D__unix
-Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 
-pedantic-errors -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 
-D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__GCC_NEW_VARARGS__ 
-Acpu=sparc -Amachine=sparc fultest.cpp fultest.ii
GNU CPP version 3.0.1 (cpplib) (sparc)
ignoring nonexistent directory "/sw/gcc-3.0.1/sparc-sun-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
  /sw/gcc-3.0.1/include/g++-v3
  /sw/gcc-3.0.1/include/g++-v3/sparc-sun-solaris2.8
  /sw/gcc-3.0.1/include/g++-v3/backward
  /usr/local/include
  /sw/gcc-3.0.1/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/include
  /usr/include
End of search list.
  /sw/gcc-3.0.1/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/cc1plus 
-fpreprocessed fultest.ii -quiet -dumpbase fultest.cpp -pedantic-errors 
-version -o fultest.s
GNU CPP version 3.0.1 (cpplib) (sparc)
GNU C++ version 3.0.1 (sparc-sun-solaris2.8)
         compiled by GNU C version 3.0.1.
fultest.cpp: In constructor `Foo<T>::Foo()':
fultest.cpp:6: parse error before `;' token

Regards, Joe Lindström

Attachment: fultest.ii.gz
Description: application/gzip

#include <list.h>

template <class T>
class Foo {
  Foo() {
    list<Bar>::iterator itr;
  }
  class Bar {
    T sak;
  };
};

int main(void) {
  return 0;
}

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