18761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// RUN: %clang_cc1 -fsyntax-only -verify %s 28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics 38761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth 48761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// C++0x [class.nest] p3: 58761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// If class X is defined in a namespace scope, a nested class Y may be 68761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// declared in class X and later defined in the definition of class X or be 78761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// later defined in a namespace scope enclosing the definition of class X. 88761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth 98761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruthnamespace example { 108761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth class E { 118761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth class I1; 128761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth class I2; 138761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth class I1 { }; 148761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth }; 158761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth class E::I2 { }; 168761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth} 178761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth 188761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth// Don't insert out-of-line inner class definitions into the namespace scope. 198761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruthnamespace PR6107 { 208761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth struct S1 { }; 218761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth struct S2 { 228761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth struct S1; 238761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth }; 248761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth struct S2::S1 { }; 258761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth S1 s1; 268761d680eaa7386e03f51286f4b84a1ffe575e2eChandler Carruth} 27