The following code compiles perfectly with gcc 3.3.3 (xlc,icc):
g++ (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

With gcc 4.0.2:
> g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared
--with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)

And with gcc 3.4.5
> g++-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,f77,pascal,objc,ada --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug i486-linux-gnu
Thread model: posix
gcc version 3.4.5 20050809 (prerelease) (Ubuntu 3.4.4-6ubuntu8)

the following error occurs:
short.cpp: In constructor &#8216;B<T_t>::B(T_t)&#8217;:
short.cpp:16: error: &#8216;data&#8217; was not declared in this scope




code:
#include <iostream>

using namespace std;

template<class T_t ,class T_leaftype> class A
{
public:
    T_t data;    
    T_t getData() {return data;}
};


template<class T_t> class B : public A<T_t, B< T_t >  >
{
public:
    B(T_t p) { data = p; }
};

int main()
{
        B<int> test(1);
        cout << test.getData() << endl;
}


-- 
           Summary: Barton-Nackman-Trick with more than one template
                    parameter fails with gcc>3.3.3
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: a dot dolfen at fz-juelich dot de
  GCC host triplet: Linux
GCC target triplet: Linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25827

Reply via email to