From -6845038729794557265
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,816731d0da79d001
X-Google-Attributes: gidf78e5,public
From: Norbert Berzen <norbert@dune.gia.rwth-aachen.de>
Subject: Re: Just a simple question
Date: 1998/07/29
Message-ID: <35BD83F7.794B@dune.gia.rwth-aachen.de>#1/1
X-Deja-AN: 375964967
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
Content-Transfer-Encoding: 7bit
References: <35BC433E.41C6@dune.gia.rwth-aachen.de>
Organization: Geodaetisches Institut der RWTH Aachen, Templergraben 55, D-52056 Aachen
X-Original-Date: Tue, 28 Jul 1998 09:55:35 +0200
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANb8JdeEDnX0m9pzZAQGP1wF+P/z2PYt8YeER9KBwBtAmOkrPBnHyihCQ A7n2cz2JYuS06dTK+7BgK2rY5zaSVcyF =5eH5
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: comp.std.c++

Hello again,

Norbert Berzen wrote (quoted text slightly modified/augmented!):

> struct Outer {
>   struct Inter {
>     struct Inner {
>       int i;
>     };
>   };
>
>   struct Other : public Inter::Inner { };
> };
>
> void
> f (Outer::Other *op)
> {
>   op -> i = 0;                        // a)
>   op -> Inner::i = 0;                 // b)
>   op -> Inter::Inner::i = 0;          // c)
>   op -> Outer::Inter::Inner::i = 0;   // d)
>   op -> ::Outer::Inter::Inner::i = 0; // e)
> }

... did some tests under "DEC OSF1 V3.2" using gcc-2.8.1,
tcc-4.1.2 and DEC-cxx-5.1-1 and got the following results:

      gcc-2.8.1 tcc-4.1.2 cxx-5.1-1
      -----------------------------
  a)      +         +        +
  b)      +         +        -
  c)      -         -        -
  d)      +         +        +
  e)      +         +        -

+ := compiles o.k.
- := fails to compile

My opinion is as follows:

a) o.k. no question

b) Don't know. On one hand one could say that after
   seeing `op ->' the current scope for name lookup
   should be `Outer' and in `Outer' there is no
   directly visible `Inner', so it should not compile!
   
   On the other hand one could say `Other' is derived
   from a base class named `Inner' no matter if it
   is visible right now and the member `i' is correctly
   qualified by the name of the base class where
   it does belong to, so it should compile o.k.!

c) should compile ok since after seeing `op ->'
   the current scope for name lookup should be
   `Outer' and `Inner' should be visible from there
   when qualified by the directly visible `Inter'.
   So member `i' is uniquely and correctly qualified
   by `Other''s base `Inter::Inner'.

d) o.k. no question

e) o.k. no question

My feeling says that either should compile o.k.!

-- 
Norbert [norbert@dune.gia.rwth-aachen.de  (134.130.159.38)]

N. Berzen, Geod. Inst. der RWTH-Aachen, Templergraben 55, 52056 Aachen
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



