Debian Codegraph @

clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-inline-namespace.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2
3 // C++11 [basic.lookup.argdep]p2
4 //
5 // [...] If an associated namespace is an inline namespace (10.3.1), its
6 // enclosing namespace is also included in the set. If an associated
7 // namespace directly contains inline namespaces, those inline namespaces
8 // are also included in the set.
9
10 namespace test1 {
11 namespace L {
12 namespace M {
13 inline namespace N {
14 inline namespace O {
15 struct S {};
16 void f1(S);
17 }
18 void f2(S);
19 }
20 void f3(S);
21 }
22 void f4(M::S); // expected-note {{declared here}}
23 }
24
25 void test() {
26 L::M::S s;
27 f1(s); // ok
28 f2(s); // ok
29 f3(s); // ok
30 f4(s); // expected-error {{use of undeclared}}
31 }
32 }
33
34 namespace test2 {
35 namespace L {
36 struct S {};
37 inline namespace M {
38 inline namespace N {
39 inline namespace O {
40 void f1(S);
41 }
42 void f2(S);
43 }
44 void f3(S);
45 }
46 void f4(S);
47 }
48
49 void test() {
50 L::S s;
51 f1(s); // ok
52 f2(s); // ok
53 f3(s); // ok
54 f4(s); // ok
55 }
56 }