1 | // In top-level scope. |
2 | struct TopLevelStruct { |
3 | int member; |
4 | }; |
5 | TopLevelStruct top_level_struct; |
6 | |
7 | // Nested in a class. |
8 | struct OuterStruct { |
9 | struct InnerStruct { |
10 | int member; |
11 | }; |
12 | }; |
13 | OuterStruct::InnerStruct inner_struct; |
14 | |
15 | // Behind typedef. |
16 | struct UnderlyingTypedefStruct { |
17 | int member; |
18 | }; |
19 | typedef UnderlyingTypedefStruct TypedefStruct; |
20 | TypedefStruct typedef_struct; |
21 | |
22 | // In namespace. |
23 | namespace NS { |
24 | struct NamespaceStruct { |
25 | int member; |
26 | }; |
27 | } // namespace NS |
28 | NS::NamespaceStruct namespace_struct; |
29 | |
30 | // In unnamed namespace. |
31 | namespace { |
32 | struct UnnamedNamespaceStruct { |
33 | int member; |
34 | }; |
35 | } // namespace |
36 | UnnamedNamespaceStruct unnamed_namespace_struct; |
37 | |
38 | // In linkage spec. |
39 | extern "C" { |
40 | struct ExternCStruct { |
41 | int member; |
42 | }; |
43 | } |
44 | ExternCStruct extern_c_struct; |
45 | |
46 | int main() { |
47 | struct DeclInFunc { |
48 | int member; |
49 | }; |
50 | |
51 | DeclInFunc decl_in_func; |
52 | return unnamed_namespace_struct.member; // break here |
53 | } |
54 | |