1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc // expected-no-diagnostics 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc // C++0x [class.nest] p3: 5*f4a2713aSLionel Sambuc // If class X is defined in a namespace scope, a nested class Y may be 6*f4a2713aSLionel Sambuc // declared in class X and later defined in the definition of class X or be 7*f4a2713aSLionel Sambuc // later defined in a namespace scope enclosing the definition of class X. 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc namespace example { 10*f4a2713aSLionel Sambuc class E { 11*f4a2713aSLionel Sambuc class I1; 12*f4a2713aSLionel Sambuc class I2; 13*f4a2713aSLionel Sambuc class I1 { }; 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc class E::I2 { }; 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc // Don't insert out-of-line inner class definitions into the namespace scope. 19*f4a2713aSLionel Sambuc namespace PR6107 { 20*f4a2713aSLionel Sambuc struct S1 { }; 21*f4a2713aSLionel Sambuc struct S2 { 22*f4a2713aSLionel Sambuc struct S1; 23*f4a2713aSLionel Sambuc }; 24*f4a2713aSLionel Sambuc struct S2::S1 { }; 25*f4a2713aSLionel Sambuc S1 s1; 26*f4a2713aSLionel Sambuc } 27