Regression from 3.0

Theodore Papadopoulo Theodore.Papadopoulo@sophia.inria.fr
Tue May 7 10:35:00 GMT 2002


For information, I have just filed a gnat report for a regression of 
3.2 with respect to 3.0 and 2.95. I do not know what happens with 
3.1, so someone may want to give the code a try. It is maybe too late 
for being corrected in 3.1, but just in case I wanted you to know.

The minimal test case is:

// Build don't link:
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>

struct A {
    struct H {
        A& a;
        H(A& b): a(b) { }
        virtual operator int() const = 0;
    };

    struct R: public H {
        R(A& a):H(a) { }
        operator int() const { return 1; }
    };

    R r() { return R(*this); }
};

int
main()
{
    A a;
    int i = a.r();
}

The program above does not compile with gcc version 3.2 20020424, 
whereas it is a conforming one in my opinion.

vanuatu->g++ toto.C
toto.C: In copy constructor `A::H::H(const A::H&)':
toto.C:13: `const' qualifiers cannot be applied to `A&'


 --------------------------------------------------------------------
 Theodore Papadopoulo
 Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------





More information about the Gcc-bugs mailing list