aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/c_compiler/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/standalone/c_compiler/test.cpp')
-rw-r--r--test/standalone/c_compiler/test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/standalone/c_compiler/test.cpp b/test/standalone/c_compiler/test.cpp
new file mode 100644
index 0000000000..f10a9e0c00
--- /dev/null
+++ b/test/standalone/c_compiler/test.cpp
@@ -0,0 +1,26 @@
+#include <iostream>
+#include <cassert>
+
+class CTest {
+public:
+ CTest(int val) : m_val(val) {};
+ virtual ~CTest() {}
+
+ virtual int getVal() const { return m_val; }
+ virtual void printVal() { std::cout << "val=" << m_val << std::endl; }
+private:
+ int m_val;
+};
+
+int main (int argc, char *argv[])
+{
+ auto* t = new CTest(123);
+ assert(t->getVal()!=456);
+ if (argc>1) t->printVal();
+ bool ok = t->getVal() == 123;
+ delete t;
+
+ if (!ok) abort();
+
+ return 0;
+}