This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95.2 bug report: Templates
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95.2 bug report: Templates
- From: "Robert C. Paulsen, Jr." <paulsen at texas dot net>
- Date: Sun, 13 Feb 2000 11:13:31 -0600
- Organization: .
/*
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