summaryrefslogtreecommitdiff
path: root/libvtv/testsuite/libvtv.cc/bb_tests.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libvtv/testsuite/libvtv.cc/bb_tests.cc')
-rw-r--r--libvtv/testsuite/libvtv.cc/bb_tests.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/libvtv/testsuite/libvtv.cc/bb_tests.cc b/libvtv/testsuite/libvtv.cc/bb_tests.cc
new file mode 100644
index 00000000000..2a2447d02c8
--- /dev/null
+++ b/libvtv/testsuite/libvtv.cc/bb_tests.cc
@@ -0,0 +1,53 @@
+// { dg-do run }
+struct base
+{
+ int total;
+ virtual void add (int i) { total += i; }
+ virtual void sub (int i) { total -= i; }
+ virtual void init (void) { total = 73; }
+};
+
+struct derived : public base
+{
+ int total;
+ virtual void add (int i) { total += 10 * i; }
+ virtual void sub (int i) { total -= 2 * i; }
+ virtual void init (void) { total = 0; }
+};
+
+bool
+get_cond_value (int x)
+{
+ if ((x % 3) > 0)
+ return true;
+ else
+ return false;
+
+ return false;
+}
+
+int
+main (int argc, char **argv)
+{
+ base *a;
+ bool cond_value = get_cond_value (10);
+ int x;
+
+ if (cond_value)
+ a = new base ();
+ else
+ a = new derived ();
+
+ cond_value = get_cond_value (47);
+ x = 0;
+ if (!cond_value)
+ x = 17;
+
+ a->init ();
+
+ for ( ; x < 10; ++x)
+ {
+ a->add(50);
+ a->sub(25);
+ }
+}