Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A point from C++0x draft : n3290

Tags:

c++

c++11

A point from N3290 draft ISO Standard, §3.4.1/12:

During the lookup of a name used in the constant-expression of an enumerator-definition, previously declared enumerators of the enumeration are visible and hide the names of entities declared in the block, class, or namespace scopes containing the enum-specifier.

This is the added new point, can any one explain this..point with an example (in terms of an example) please?

like image 746
user767856 Avatar asked Dec 28 '22 20:12

user767856


1 Answers

Let's just have some code:

struct X {};

enum Foo
{
  X = 0,
  Y,
  Z = X // X refers to the enum, not the type
};
like image 81
Matthieu M. Avatar answered Jan 13 '23 11:01

Matthieu M.