[llvm-commits] CVS: llvm/test/Regression/C++Frontend/pointer_member.cpp pointer_method.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue May 13 14:51:01 PDT 2003
Changes in directory llvm/test/Regression/C++Frontend:
pointer_member.cpp updated: 1.2 -> 1.3
pointer_method.cpp updated: 1.1 -> 1.2
---
Log message:
Make test cases executable
---
Diffs of the changes:
Index: llvm/test/Regression/C++Frontend/pointer_member.cpp
diff -u llvm/test/Regression/C++Frontend/pointer_member.cpp:1.2 llvm/test/Regression/C++Frontend/pointer_member.cpp:1.3
--- llvm/test/Regression/C++Frontend/pointer_member.cpp:1.2 Mon May 12 18:33:00 2003
+++ llvm/test/Regression/C++Frontend/pointer_member.cpp Tue May 13 14:50:01 2003
@@ -1,5 +1,17 @@
+#include <stdio.h>
+
struct B { int i, j; };
struct D : public B {};
int D::*di = &D::i;
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;
+}
Index: llvm/test/Regression/C++Frontend/pointer_method.cpp
diff -u llvm/test/Regression/C++Frontend/pointer_method.cpp:1.1 llvm/test/Regression/C++Frontend/pointer_method.cpp:1.2
--- llvm/test/Regression/C++Frontend/pointer_method.cpp:1.1 Mon May 12 18:34:59 2003
+++ llvm/test/Regression/C++Frontend/pointer_method.cpp Tue May 13 14:50:01 2003
@@ -1,8 +1,23 @@
-struct B { int i(); int j(); };
+#include <stdio.h>
-void foo(int (B::*Fn)());
+struct B {
+ int X;
+ void i() {
+ printf("i, %d\n", X);
+ }
+ void j() {
+ printf("j, %d\n", X);
+ }
+};
-void test() {
- foo(&B::i);
- foo(&B::j);
+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;
}
More information about the llvm-commits
mailing list