blob: d0bb338e873cd568e0b734d6223181830f23ede5 [file] [log] [blame]
Douglas Gregor44b43212008-12-11 16:49:14 +00001// RUN: clang -fsyntax-only -verify %s
2
3namespace Ns {
4 int f(); // expected-note{{previous declaration is here}}
5}
6namespace Ns {
7 double f(); // expected-error{{functions that differ only in their return type cannot be overloaded}}
8}
9
10namespace Ns2 {
11 float f();
12}
13
14namespace Ns2 {
15 float f(int); // expected-note{{previous declaration is here}}
16}
17
18namespace Ns2 {
19 double f(int); // expected-error{{functions that differ only in their return type cannot be overloaded}}
20}
21
22namespace N {
23 int& f1();
24}
25
26namespace N {
27 struct f1 {
28 static int member;
29 };
30
31 void test_f1() {
32 int &i1 = f1();
33 }
34}
35
36namespace N {
37 float& f1(int);
38
39 struct f2 {
40 static int member;
41 };
42 void f2();
43}
44
45int i1 = N::f1::member;
46typedef struct N::f1 type1;
47int i2 = N::f2::member;
48typedef struct N::f2 type2;
49
50void test_f1(int i) {
51 int &v1 = N::f1();
52 float &v2 = N::f1(i);
Chris Lattnera67865c2009-01-05 00:59:08 +000053 int v3 = ::i1;
Douglas Gregor44b43212008-12-11 16:49:14 +000054}
Chris Lattnera67865c2009-01-05 00:59:08 +000055