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

Bug#431045: marked as done (g++-4.2: Template arguments to template functions not working)



Your message dated Mon, 23 Jul 2007 11:20:43 +0200
with message-id <18084.29419.995167.292892@gargle.gargle.HOWL>
and subject line Bug#431045: Question about validity of wfmath template code
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
Daniel Schepler writes:
> After analyzing a build failure of wfmath with gcc-4.2, I condensed the issue 
> it was having to the following test case:
> 
> template <class T, class U = int> class A { public: T x1; U x2; };
> template <template<class> class container_with_x1>
> int f(const container_with_x1<int>& y) {
>   return y.x1;
> }
> int g() {
>   A<int> y;
>   return f(y);
> }
> 
> This code compiles with g++-4.1, but fails with g++-4.2 and the snapshot of 
> g++-4.3 currently in Debian's gcc-snapshot package.  My question is: is this 
> valid code or not?

Brian M. Carlson writes:
> According to http://gcc.gnu.org/gcc-4.2/changes.html (second bullet
> point under C++), I don't believe this is valid.  The example you gave
> and the example on the changes page look very, very similar, and are
> probably isomorphic, which does not bode well for wfmath.

--- End Message ---

Reply to: