Parse error in pedantic mode passing template args to templates.

Geir Bjarte Terum gb@funcom.com
Mon May 31 10:49:00 GMT 1999


// Subject: Parse error in pedantic mode passing template args to
templates.
//
// Command line: g++ -Wall -ansi -pedantic -DFORCE_PARSE_ERROR
test_fpe.cpp
//
// Versions:
//   gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
//   gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
//
// Platforms:
// * Digital Unix
// * IRIX
// * Linux

#include <list>

std::list<int> my_list;

template <class T>
struct B {
  void f() {
#ifdef FORCE_PARSE_ERROR
    std::list<T>::iterator it;        // parse error before `;'
#else
    std::list<int>::iterator it;      // OK!
#endif
    it = my_list.begin();
  }
};

int main() {
  B<int> b;
  b.f();     // Comment out this line, and still get parse error.
  return 0;
}




More information about the Gcc-bugs mailing list