C++ Logo

std-discussion

Advanced search

Re: using and weird member access

From: Yongwei Wu <wuyongwei_at_[hidden]>
Date: Tue, 12 May 2026 21:56:36 +0800
On Tue, 12 May 2026 at 21:46, Ell <ell.ell.se_at_[hidden]> wrote:
>
> On Tuesday, May 12th, 2026 at 2:49 PM, Yongwei Wu via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> > Actually, if we change
> >
> > struct Derived : public Middle { public: using ::Base::member; };
> >
> > to
> >
> > struct Derived : public Middle { public: using Base::member; };
> >
> > Clang will reject the code. So it seems to me that Clang is applying different rules to the type identification and the using declaration. But [namespace.udecl]/3 says each using-declarator shall either name an enumerator or have a nested-name-specifier naming a base class of the current class.
> >
> > So now I think Clang is simply confused and this is a bug.
>
> `Base` in this context refers to Base's injected class name, which is inaccessible
> (unlikne `::Base`).

>From outside the class, either form is accessible. From the context of
"using", which requires "naming a base class of the current class",
neither form is accessible.

-- 
Yongwei Wu
URL: http://wyw.dcweb.cn/

Received on 2026-05-12 13:56:50