attr-callback.cpp
1.63 KB
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
// RUN: %clang_cc1 %s -verify -fsyntax-only
// expected-no-diagnostics
class C_in_class {
#include "../Sema/attr-callback.c"
};
struct Base {
void no_args_1(void (*callback)(void));
__attribute__((callback(1))) void no_args_2(void (*callback)(void));
__attribute__((callback(callback))) void no_args_3(void (*callback)(void)) {}
__attribute__((callback(1, 0))) virtual void
this_tr(void (*callback)(Base *));
__attribute__((callback(1, this, __, this))) virtual void
this_unknown_this(void (*callback)(Base *, Base *, Base *));
__attribute__((callback(1))) virtual void
virtual_1(void (*callback)(void));
__attribute__((callback(callback))) virtual void
virtual_2(void (*callback)(void));
__attribute__((callback(1))) virtual void
virtual_3(void (*callback)(void));
};
__attribute__((callback(1))) void
Base::no_args_1(void (*callback)(void)) {
}
void Base::no_args_2(void (*callback)(void)) {
}
struct Derived_1 : public Base {
__attribute__((callback(1, 0))) virtual void
this_tr(void (*callback)(Base *)) override;
__attribute__((callback(1))) virtual void
virtual_1(void (*callback)(void)) override {}
virtual void
virtual_3(void (*callback)(void)) override {}
};
struct Derived_2 : public Base {
__attribute__((callback(callback))) virtual void
virtual_1(void (*callback)(void)) override;
virtual void
virtual_2(void (*callback)(void)) override;
virtual void
virtual_3(void (*callback)(void)) override;
};
void Derived_2::virtual_1(void (*callback)(void)) {}
__attribute__((callback(1))) void
Derived_2::virtual_2(void (*callback)(void)) {}
void Derived_2::virtual_3(void (*callback)(void)) {}