xbyak/test/lib_min.cpp

52 lines
546 B
C++
Raw Normal View History

2012-12-02 17:28:05 -07:00
#include <stdio.h>
2012-12-04 00:12:59 -07:00
static const struct XXX {
XXX() { puts("XXX"); }
} s_sss;
2012-12-02 17:28:05 -07:00
struct A {
2012-12-02 17:45:20 -07:00
int aaa;
2012-12-02 17:28:05 -07:00
A()
2012-12-02 17:45:20 -07:00
: aaa(123)
2012-12-02 17:28:05 -07:00
{
puts("A cstr");
}
~A()
{
puts("A dstr");
}
void put() const
{
2012-12-02 17:45:20 -07:00
printf("aaa=%d\n", aaa);
2012-12-02 17:28:05 -07:00
}
};
template<int dummy = 0>
struct XT {
2012-12-02 17:45:20 -07:00
static A sss;
2012-12-02 17:28:05 -07:00
};
template<int dummy>
2012-12-02 17:45:20 -07:00
A XT<dummy>::sss;
2012-12-02 17:28:05 -07:00
typedef XT<0> X;
static struct Init {
Init()
{
puts("Init");
2012-12-02 17:45:20 -07:00
X::sss.put();
2012-12-02 17:28:05 -07:00
}
} s_init;
2012-12-04 00:12:59 -07:00
int f() { puts("f"); return 4; }
static const int r = f();
2012-12-02 17:28:05 -07:00
int main()
{
puts("main");
2012-12-04 00:12:59 -07:00
printf("r=%d\n", r);
2012-12-02 17:45:20 -07:00
X::sss.put();
2012-12-02 17:28:05 -07:00
}