Bug 28836 - gcc 4.1.1 rejects possible valid code containing the "using" keyword
Summary: gcc 4.1.1 rejects possible valid code containing the "using" keyword
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-24 14:48 UTC by Werner Van Geit
Modified: 2006-08-24 14:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Werner Van Geit 2006-08-24 14:48:50 UTC
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
Comment 1 Andrew Pinski 2006-08-24 14:57:45 UTC
4.0.x was incorrect in accepting this code in the first place.