From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16772 invoked by alias); 18 Jul 2002 08:16:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16715 invoked by uid 71); 18 Jul 2002 08:16:02 -0000 Resent-Date: 18 Jul 2002 08:16:02 -0000 Resent-Message-ID: <20020718081602.16710.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, wolfgang.bangerth@iwr.uni-heidelberg.de Received: (qmail 14971 invoked by uid 61); 18 Jul 2002 08:06:48 -0000 Message-Id: <20020718080648.14966.qmail@sources.redhat.com> Date: Thu, 18 Jul 2002 01:16:00 -0000 From: wolfgang.bangerth@iwr.uni-heidelberg.de Reply-To: wolfgang.bangerth@iwr.uni-heidelberg.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7347: Typedef'ing a protected typedef disallowed X-SW-Source: 2002-07/txt/msg00544.txt.bz2 List-Id: >Number: 7347 >Category: c++ >Synopsis: Typedef'ing a protected typedef disallowed >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Jul 18 01:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Wolfgang Bangerth >Release: unknown-1.0 >Organization: >Environment: gcc 3.2 pre of 2002-07-17 >Description: A base class declares a protected typedef. A derived class declares a public typedef to the protected typedef of the base class, thus exposing the protected typedef of the base class publicly. Using it then fails: -------------------------------------- template class Base { protected: typedef int T; }; template class D : public Base { public: typedef typename Base::T T1; D (T1 t); }; D<2> d(1); ----------------------------------- The messages reported are as follows: x.cc: In instantiation of `D::D(typename Base::T) [with int dim = 2]': x.cc:13: instantiated from here x.cc:3: error: `typedef int Base<2>::T' is protected x.cc:10: error: within this context This is a relatively new failure, it is in no released version of the compiler, and I did also not see it a couple of weeks ago. To be honest, I am not really sure what the standard says about this, after all the typedef in the derived class references some protected type, but that would imply that typedefs build a long chain and access has to be checked at each stage; the other view would be that each typedef refers to a concrete type, rather than to a sequence of typedefs -- in this case the second typedef would just refer to "int", which certainly is not a protected member of the base class :-) BTW: One thing that _is_ suspicious is that the problem only appears if the class is a template -- if it is a normal class, then everything compiles cleanly. I think that this incoherence qualifies as a bug in any case! Regards Wolfgang >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: