[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#431045: g++-4.2: Template arguments to template functions not working



Package: g++-4.2
Version: 4.2-20070627-1
Severity: normal

I condensed the wfmath build failure with gcc-4.2 (#361815) into a small test
case:

frobnitz:/tmp# cat test.cc
#include <vector>

template <template<class> class container>
int sum(const container<int>& x) {
  int result = 0;
  for (typename container<int>::const_iterator i = x.begin(); i != x.end(); i++) result += *i;
  return result;
}

int test() {
  std::vector<int> x;
  return sum(x);
}
frobnitz:/tmp# g++-4.1 -c test.cc
frobnitz:/tmp# g++-4.2 -c test.cc
test.cc: In function 'int test()':
test.cc:12: error: no matching function for call to 'sum(std::vector<int, std::allocator<int> >&)'
frobnitz:/tmp# /usr/lib/gcc-snapshot/bin/g++ -c test.cc
test.cc: In function 'int test()':
test.cc:12: error: no matching function for call to 'sum(std::vector<int, std::allocator<int> >&)'
-- 
Daniel Schepler



Reply to: