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

Bug#420189: g++-4.1: fails to compile correct template code - 4.1.[01] regression



Package: g++-4.1
Version: 4.1.1-21
Severity: normal

Hi,

I have problems with some heavy templated code, which can't be compiled
by g++ 4.1.1. It's not an ICE!

The following compilers (Debian packages) do compile it:
g++-3.3, g++-3.4, g++-4.0, g++-4.1.2 (Debian experimental)
I have no 4.1.0 available to test, but it's definitively fixed in 4.1.2
(both in manually compiled upstream source and in Debian
experimental package).
There is probably a PR for it, but checking the titles of the PRs fixed
in 4.1.2 didn't result in anything interesting.

I attach a small testcase. This requires the stxxl
(stxxl.sourceforge.net) to be installed. Since this is already fixed
upstream I'm not going to minimize the testcase any further.

The following error message is generated:

cxxbug.cpp: In instantiation of ‘VectorType<int, stxxl::VECTOR_GENERATOR>’:
cxxbug.cpp:30:   instantiated from ‘void f() [with Vector = stxxl::VECTOR_GENERATOR]’
cxxbug.cpp:35:   instantiated from here
cxxbug.cpp:23: error: no type named ‘size_type’ in ‘struct stxxl::VECTOR_GENERATOR<int, 4u, 8u, 2097152u, stxxl::RC, lru>’
cxxbug.cpp: In function ‘void f() [with Vector = stxxl::VECTOR_GENERATOR]’:
cxxbug.cpp:35:   instantiated from here
cxxbug.cpp:30: error: no matching function for call to ‘VectorType<int, stxxl::VECTOR_GENERATOR>::VectorType()’
cxxbug.cpp:20: note: candidates are: VectorType<int, stxxl::VECTOR_GENERATOR>::VectorType(const VectorType<int, stxxl::VECTOR_GENERATOR>&)

Unfortunately, this affects the new stable etch, too :-(


Andreas


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable'), (300, 'unstable'), (30, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.1 depends on:
ii  gcc-4.1                       4.1.1-21   The GNU C compiler
ii  gcc-4.1-base                  4.1.1-21   The GNU Compiler Collection (base 
ii  libc6                         2.5-2      GNU C Library: Shared libraries
ii  libstdc++6-4.1-dev            4.1.1-21   The GNU Standard C++ Library v3 (d

g++-4.1 recommends no packages.

-- no debconf information
//#include <stxxl>
#include <containers/vector.h> // stxxl

template <class Ty,  template<class> class C >
struct Type2Type {
	typedef C<Ty> result;
};

template<class Ty>
struct Type2Type<Ty, stxxl::VECTOR_GENERATOR> {
	typedef typename stxxl::VECTOR_GENERATOR<Ty>::result result;
};

template<class Ty>
struct Type2Type<Ty, stxxl::vector> {
	typedef typename stxxl::vector<Ty, 4 , stxxl::lru_pager< 8 >,2*1024*1024,stxxl::RC,stxxl::int64> result;
};

template<class Ty, template<class> class C = std::vector >
class VectorType : public Type2Type<Ty,C>::result {
    typedef typename Type2Type<Ty,C>::result vector_type;
public:
    VectorType( typename vector_type::size_type n = 0) : vector_type(n) {}
};

template <template <class> class Vector>
void f()
{
	typedef VectorType < int, Vector > vector_type;
	vector_type v;
}

void g()
{
	f<stxxl::VECTOR_GENERATOR>();
}


Reply to: