From -4503043033493456057 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,8117e5706dc0b4bb X-Google-Attributes: gidf78e5,public From: maxtal@Physics.usyd.edu.au (John Max Skaller) Subject: Re: Redundant Using Declarations Date: 1995/05/21 Message-ID: #1/1 X-Deja-AN: 103029336 sender: news@ucc.su.OZ.AU references: <3pi75q$ihm@offas_dike.sbil.co.uk> organization: School of Physics, University of Sydney, Australia newsgroups: comp.std.c++ In article <3pi75q$ihm@offas_dike.sbil.co.uk>, Marc Shepherd wrote: >Subclause 7.3.3 of the draft WP says: > > A using-declaration is a declaration and can therefore be > used repeatedly where (and only where) multiple declarations > are allowed. No: a definition is also a declaration, and it _cannot_ be repeated: it isn't a question of where "multiple declarations" are allowed: multiple definitions in the one scope are never allowed, and multiple declarations which are not definitions always are. (Multiple declarations which are not definitions must obey certain rules about not changing linkage attributes or type or return type) > >It further gives the following examples of this rule: > > namespace A { > int i; > } > > namespace A1 { > using A::i; > using A::i; // ok: double declaration > } > > void f() > { > using A::i; > using A::i; // error: double declaration > } > > class B { > int i; > }; > > class X : public B { > using B::i; > using B::i; // error: double member declaration > }; > >My question is: in the definition of namespace A1 shown above, why >is the redundant using declaration of A::i well-formed, considering >that the following would not be: > > namespace A1 { > int i; > int i; > } Because the declaration "int i" is a definition. -- JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au Maxtal Pty Ltd, 81A Glebe Point Rd, GLEBE Mem: SA IT/9/22,SC22/WG21 NSW 2037, AUSTRALIA Phone: 61-2-566-2189