A third-party library I'm using doesn't compile with gcc 4.1.1 anymore (it
still did with 4.0). The problem is that some header files contain a code
fragment (I've stripped it down) like this:
#include <iostream>

using namespace std;

template <class F, class R> class I {
    public:
        int size;
};

template <class T> class D : private I<T, double> {
    using D< T >::size;
}; 

int main() {
    D<double> test;
    cout << "Hello world" << endl;
}

gcc 4.1.1 generates the following error:

test.cpp: In instantiation of 'D<double>':
test.cpp:15:   instantiated from here
test.cpp:11: error: type 'D<double>' is not a base type for type 'D<double>'

gcc 4.0 doesn't see any problem.

I'm not sure this kind of construct is valid. If "using D< T >::size;" is
replaced by "using I< T, double >::size;" gcc 4.1.1 is happy again.

My system is Mac OS X 10.4.7 (PowerPC). 
gcc was compiled with darwinports:

"Using built-in specs.
Target: powerpc-apple-darwin8.7.0
Configured with: ../gcc-4.1.1/configure --prefix=/opt/local
--enable-languages=c,c++,java,objc,obj-c++,fortran
--libdir=/opt/local/lib/gcc41 --includedir=/opt/local/include/gcc41
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-dp-4.1 --with-gxx-include-dir=/opt/local/include/gcc41/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-as=/opt/local/bin/odas
--with-ld=/opt/local/bin/odld --with-ar=/opt/local/bin/odar --disable-multilib
Thread model: posix
gcc version 4.1.1
"
The command used to compile was simply "g++ test.cpp"

The library that contains the code fragments is EO (Evolutionary algorithms,
http://www2.lifl.fr/~cahon/paradisEO/eo/index.html)

Thx,

Werner Van Geit


-- 
           Summary: gcc 4.1.1 rejects possible valid code containing the
                    "using" keyword
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wernervangeit at hotmail dot com


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

Reply via email to