diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-01-14 14:40:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-14 14:40:54 -0500 |
| commit | 1e481dfef5a2241bfc5460214dbd0daffe5063bc (patch) | |
| tree | ddb96972a8c593556b9d567e1b66ef3042ca2d0d /test | |
| parent | a64989ee704255f61639c9714c5a38b4d6eb0a9e (diff) | |
| parent | 3ed074171848f8ecbd57f8f361b790edfea97731 (diff) | |
| download | zig-1e481dfef5a2241bfc5460214dbd0daffe5063bc.tar.gz zig-1e481dfef5a2241bfc5460214dbd0daffe5063bc.zip | |
Merge pull request #10587 from xxxbxxx/master
restore compatibility with glibc<=2.33 for global initializers
Diffstat (limited to 'test')
| -rw-r--r-- | test/standalone/c_compiler/test.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/standalone/c_compiler/test.cpp b/test/standalone/c_compiler/test.cpp index f10a9e0c00..8c533d02cc 100644 --- a/test/standalone/c_compiler/test.cpp +++ b/test/standalone/c_compiler/test.cpp @@ -12,15 +12,22 @@ private: int m_val; }; + +volatile int runtime_val = 456; +CTest global(runtime_val); // test if global initializers are called. + int main (int argc, char *argv[]) { + assert(global.getVal() == 456); + auto* t = new CTest(123); assert(t->getVal()!=456); - if (argc>1) t->printVal(); + + if (argc>1) t->printVal(); bool ok = t->getVal() == 123; delete t; - if (!ok) abort(); + if (!ok) abort(); return 0; } |
