This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ parser issue [templ.res]


Jan Van Dijk wrote:

<quote>

OK, I did some more homework. A few possible issues (and an ICE) remain.
Consider:

template <class T> struct B { int i; };
template <class T> struct D : public B<T>
{
        // D<T> and B<T> are dependent: OK
        void i1() { D<T>::i=0; }
        void i2() { B<T>::i=0; }
        // 14.6.2.2/2: `this' is inside i3(), enclosing class dependent.
	// Hence this is dependent. It is part of the expression: OK.
        void i3() { this->i=0; }

        // this should not compile, and doesn't: OK
        void i4() { i=0; }

        // 3.4.1/2 does not work here: this does not compile. Why?
        using B<T>::i;
        void i5() { i=0; }
        // and this causes an ICE:
        void i6() { using B<T>::i; i=0; }
};

OK, so gcc (HEAD,yesterday) now correctly compiles i1(), i2() and i3(),
and
correctly refuses i4(). But is it correct that i5() does not compile? I
would
think that 3.4.1/2 (using directive) would work as usual. It would bring i
in
scope, and from the using statement (using B<T>::i) it is obvious that i
is a
dependent name. Hence i5() seems correct, apart from the semantics it
would
be no different from i2(). The same goes for i6(), but that even causes an
ICE:

t.cpp:17: internal compiler error: in validate_nonmember_using_decl, at
   cp/decl2.c:4152

which is obviously not good behaviour.

<endquote>

These are c++/9432 (ICE) and c++/9447 (not working using directive).

Richard.

--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]