http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Bug #: 51214 Summary: [C++11] name lookup issue with c++11 enums Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: fab...@gcc.gnu.org Noticed while working on PR c++/51188, I have launched the c++ testsuite with the patch below: Index: class.c =================================================================== --- class.c (revision 181491) +++ class.c (working copy) @@ -6007,7 +6007,7 @@ finish_struct_1 (tree t) hierarchy), and we want this failure to occur quickly. */ n_fields = count_fields (TYPE_FIELDS (t)); - if (n_fields > 7) + if (n_fields > 0) And it has raised two errors related to c++11 enums: forw_enum5.C and forw_enum9.C. Thus, here is a reproducer, comming from forw_enum5.C: // { dg-do compile } // { dg-options "-std=c++0x" } namespace one { struct S { enum { A = 1, B = 2 }; struct T { int i1, i2, i3, i4, i5, i6, i7; enum { B = 102 }; enum class E1; enum E2 : int; }; }; static_assert(int(S::T::A1) == 1, "error"); static_assert(int(S::T::B1) == 102, "error"); static_assert(int(S::T::C1) == 103, "error"); } The following errors are issued: error: 'A1' is not a member of 'one::S::T' error: 'B1' is not a member of 'one::S::T' error: 'C1' is not a member of 'one::S::T' Most likely an issue in the sorted case of lookup_field_1. Mine.