public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7347: Typedef'ing a protected typedef disallowed
@ 2002-07-23  7:25 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2002-07-23  7:25 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lerdsuwa, wolfgang.bangerth

Synopsis: Typedef'ing a protected typedef disallowed

State-Changed-From-To: analyzed->closed
State-Changed-By: lerdsuwa
State-Changed-When: Tue Jul 23 07:25:52 2002
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7347


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7347: Typedef'ing a protected typedef disallowed
@ 2002-07-18  8:40 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2002-07-18  8:40 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lerdsuwa, wolfgang.bangerth

Synopsis: Typedef'ing a protected typedef disallowed

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Jul 18 08:40:22 2002
State-Changed-Why:
    Confirmed.  Patch in progress.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7347


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/7347: Typedef'ing a protected typedef disallowed
@ 2002-07-18  6:27 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2002-07-18  6:27 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lerdsuwa, nobody, wolfgang.bangerth

Synopsis: Typedef'ing a protected typedef disallowed

Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-By: lerdsuwa
Responsible-Changed-When: Thu Jul 18 06:27:48 2002
Responsible-Changed-Why:
    Under investigation.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7347


^ permalink raw reply	[flat|nested] 4+ messages in thread

* c++/7347: Typedef'ing a protected typedef disallowed
@ 2002-07-18  1:16 wolfgang.bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: wolfgang.bangerth @ 2002-07-18  1:16 UTC (permalink / raw)
  To: gcc-gnats


>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 <int dim> class Base {
  protected:
    typedef int T;
};


template <int dim> class D : public Base<dim> {
  public:
    typedef typename Base<dim>::T T1;
    D (T1 t);
};

D<2> d(1);
-----------------------------------
The messages reported are as follows:

x.cc: In instantiation of `D<dim>::D(typename Base<dim>::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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-07-23 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-23  7:25 c++/7347: Typedef'ing a protected typedef disallowed lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-07-18  8:40 lerdsuwa
2002-07-18  6:27 lerdsuwa
2002-07-18  1:16 wolfgang.bangerth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).