C++ Logo

std-discussion

Advanced search

Re: Qualified name of an enumerator.

From: Andrew Tomazos <andrewtomazos_at_[hidden]>
Date: Thu, 29 Aug 2019 02:23:42 +1000
http://eel.is/c++draft/basic.lookup.qual#1


On Thu, Aug 29, 2019 at 2:20 AM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> May a name of an enumerator coincide with a name of a namespace in a using
> declaration.
>
> That is whether this using declaration
>
> using N::N;
>
>
> is valid or not and why.
>
> #include <iostream>
>
> namespace N
> {
> enum { N = 10 };
>
> void f()
> {
> std::cout << "N = " << N << '\n';
> }
> }
>
> using N::N;
>
> void f()
> {
> std::cout << "N = " << N << '\n';
> }
>
> int main()
> {
> N::f();
> f();
>
> return 0;
> }
>
>
>
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>

Received on 2019-08-28 11:25:58