mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Make test cases executable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6166 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5bd1acc0d6
commit
1f1f371d12
@ -1,5 +1,17 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
struct B { int i, j; };
|
struct B { int i, j; };
|
||||||
struct D : public B {};
|
struct D : public B {};
|
||||||
int D::*di = &D::i;
|
int D::*di = &D::i;
|
||||||
int D::*dj = &D::j;
|
int D::*dj = &D::j;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
D d;
|
||||||
|
d.i = d.j = 0;
|
||||||
|
d.*di = 4;
|
||||||
|
d.*dj = 7;
|
||||||
|
|
||||||
|
printf("%d %d\n", d.i, d.j);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
struct B { int i(); int j(); };
|
#include <stdio.h>
|
||||||
|
|
||||||
void foo(int (B::*Fn)());
|
struct B {
|
||||||
|
int X;
|
||||||
void test() {
|
void i() {
|
||||||
foo(&B::i);
|
printf("i, %d\n", X);
|
||||||
foo(&B::j);
|
}
|
||||||
|
void j() {
|
||||||
|
printf("j, %d\n", X);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void foo(int V, void (B::*Fn)()) {
|
||||||
|
B b; b.X = V;
|
||||||
|
(b.*Fn)();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
foo(4, &B::i);
|
||||||
|
foo(6, &B::j);
|
||||||
|
foo(-1, &B::i);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user