authorgravatar for xavierb@gmail.comxavier <xavierb@gmail.com> 2022-01-13 09:20:38+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-14 11:48:38-07:00
log3f52132a8f901aeb6c6e3449f1ef652a2b094e09
tree836da5af2eac40afb6c823f57d87ccb6f89e15b8
parentf1b14b91f1f0c381c0d2c8c7ba3fd8df8a937227

tests: include global initializers in c++ compiler test


1 files changed, 9 insertions(+), 2 deletions(-)

test/standalone/c_compiler/test.cpp+9-2
......@@ -12,15 +12,22 @@ private:
1212 int m_val;
1313};
1414
15
16volatile int runtime_val = 456;
17CTest global(runtime_val); // test if global initializers are called.
18
1519int main (int argc, char *argv[])
1620{
21 assert(global.getVal() == 456);
22
1723 auto* t = new CTest(123);
1824 assert(t->getVal()!=456);
19 if (argc>1) t->printVal();
25
26 if (argc>1) t->printVal();
2027 bool ok = t->getVal() == 123;
2128 delete t;
2229
23 if (!ok) abort();
30 if (!ok) abort();
2431
2532 return 0;
2633}