blob: bb87ce0f126cc402e89f5194b9a4bf243f18d5da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
// Make sure we don't produce invalid IR.
// RUN: %clang_cc1 -emit-llvm-only %s
namespace test1 {
static void foo(); // expected-warning {{function 'test1::foo' has internal linkage but is not defined}}
template <class T> static void bar(); // expected-warning {{function 'test1::bar<int>' has internal linkage but is not defined}}
void test() {
foo(); // expected-note {{used here}}
bar<int>(); // expected-note {{used here}}
}
}
namespace test2 {
namespace {
void foo(); // expected-warning {{function 'test2::<anonymous namespace>::foo' has internal linkage but is not defined}}
extern int var; // expected-warning {{variable 'test2::<anonymous namespace>::var' has internal linkage but is not defined}}
template <class T> void bar(); // expected-warning {{function 'test2::<anonymous namespace>::bar<int>' has internal linkage but is not defined}}
}
void test() {
foo(); // expected-note {{used here}}
var = 0; // expected-note {{used here}}
bar<int>(); // expected-note {{used here}}
}
}
namespace test3 {
namespace {
void foo();
extern int var;
template <class T> void bar();
}
void test() {
foo();
var = 0;
bar<int>();
}
namespace {
void foo() {}
int var = 0;
template <class T> void bar() {}
}
}
namespace test4 {
namespace {
struct A {
A(); // expected-warning {{function 'test4::<anonymous namespace>::A::A' has internal linkage but is not defined}}
~A();// expected-warning {{function 'test4::<anonymous namespace>::A::~A' has internal linkage but is not defined}}
virtual void foo(); // expected-warning {{function 'test4::<anonymous namespace>::A::foo' has internal linkage but is not defined}}
virtual void bar() = 0;
virtual void baz(); // expected-warning {{function 'test4::<anonymous namespace>::A::baz' has internal linkage but is not defined}}
};
}
void test(A &a) {
a.foo(); // expected-note {{used here}}
a.bar();
a.baz(); // expected-note {{used here}}
}
struct Test : A {
Test() {} // expected-note 2 {{used here}}
};
}
// rdar://problem/9014651
namespace test5 {
namespace {
struct A {};
}
template <class N> struct B {
static int var; // expected-warning {{variable 'test5::B<test5::<anonymous>::A>::var' has internal linkage but is not defined}}
static void foo(); // expected-warning {{function 'test5::B<test5::<anonymous>::A>::foo' has internal linkage but is not defined}}
};
void test() {
B<A>::var = 0; // expected-note {{used here}}
B<A>::foo(); // expected-note {{used here}}
}
}
|