4
votes

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?

1
This behaviour appears the same as C++03 (7.2-3)... though less technically worded...?Tony Delroy
@Tony, possibly to take into account scoped enums.AProgrammer
@Tony, @AProgrammer: it does not seem to be much different from C++03 (in effect) so perhaps was it only a clarification of the wording ?Matthieu M.
@Matthieu: yes - just seems like less formal explanation to me. @AProgrammer: if scoped enums are behind this, I can't see how.Tony Delroy

1 Answers

10
votes

Let's just have some code:

struct X {};

enum Foo
{
  X = 0,
  Y,
  Z = X // X refers to the enum, not the type
};