summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp
blob: c687eb0f092f956019a9356e52480f832b7170ca (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <cstdio>

// Since this is a global variable, its constructor will be called before
// main() is executed. But only if the object file containing it actually
// gets linked into the executable.
struct Foo {
    Foo() {
        printf("static-initializer.");
        fflush(stdout);
    }
} FOO;