Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc')
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
index 1fd97df0822..ae753028f65 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
@@ -303,6 +303,44 @@ int testArrays() {
return 1;
}
+// For bug 376901 RTTI tests
+class VirtualBase {
+public:
+ virtual ~VirtualBase() {} // Necessary to force RTTI generation for the base class
+ int a;
+private:
+ bool b;
+};
+
+class Derived: public VirtualBase {
+public:
+ int c;
+ VirtualBase* ptr;
+private:
+ bool d;
+ int e[4];
+};
+
+class OtherDerived: public VirtualBase {
+public:
+ int d;
+private:
+ bool c;
+ int f[4];
+};
+int testRTTI() {
+ Derived derived;
+ Derived child1;
+ OtherDerived child2;
+
+ derived.ptr = &child1; // here derived.b is of type bar
+
+ derived.ptr = &child2; // here derived.b is of type foo
+
+ return 1; // here derived.b is of type Derived
+}
+// End of bug 376901 RTTI tests
+
int main() {
printf("Running ExpressionTest App\n");
@@ -328,6 +366,7 @@ int main() {
testUpdateOfPointer();
testCanWrite();
testArrays();
+ testRTTI();
// For bug 320277
BaseTest b; b.test();

Back to the top