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]

gcc 2.95.2 bug report: Templates


/* 
   gcc bug report. 2/14/2000

   Problem: compiler error with template. When passing a template
   class (e.g. vector<int>) to a template function, cannot get at
   type of argument using scope resolution operator with template 
   parameter. See example code below.

   GCC version:

      g++ -v
      Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
      gcc version 2.95.2 19991024 (release)

   Compiled as follows: 

      g++ slist.cpp 
      slist.cpp: In function `void func(T)':
      slist.cpp:6: parse error before `;'

   Contact:

      paulsen@texas.net
*/

#include <vector>

template<class T>
void func( T ctr ) {
   T::iterator i;             // this fails with "parse error before ';'"
//   vector<int>::iterator i;   // this works
}

int main() {
   vector<int> vec;
   func( vec );
}

-- 
____________________________________________________________________
Robert Paulsen                         http://paulsen.home.texas.net

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