diff --git a/test/Makefile b/test/Makefile index c2be64d..c2ee8a4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -47,7 +47,7 @@ test_avx: normalize_prefix ./test_avx.sh 64 ./test_avx.sh Y64 clean: - rm -rf *.o $(TARGET) + rm -rf *.o $(TARGET) lib_run lib_run: lib_test.cpp lib_run.cpp $(CXX) $(CFLAGS) lib_run.cpp lib_test.cpp -o lib_run diff --git a/test/lib.h b/test/lib.h index 86a6f41..d1ef9d3 100644 --- a/test/lib.h +++ b/test/lib.h @@ -1,6 +1,33 @@ #pragma once #include +struct A { + int a; + A() + : a(5) + { + puts("A cstr"); + } + ~A() + { + puts("A dstr"); + } + void put() const + { + printf("a=%d\n", a); + } +}; + +template +struct XT { + static A a; +}; + +template +A XT::a; + +typedef XT<0> X; + void init(); static struct Init { diff --git a/test/lib_run.cpp b/test/lib_run.cpp index cf18722..459092a 100644 --- a/test/lib_run.cpp +++ b/test/lib_run.cpp @@ -2,5 +2,7 @@ int main() { + puts("main"); + X::a.put(); } diff --git a/test/lib_test.cpp b/test/lib_test.cpp index d5c91fe..dc7eee1 100644 --- a/test/lib_test.cpp +++ b/test/lib_test.cpp @@ -1,23 +1,12 @@ #include "lib.h" -#include - -struct Code : public Xbyak::CodeGenerator { - Code() - { - printf("Code:%s\n", eax.toString()); - ret(); - } -}; void init() - try { static bool init = true; printf("in lib_test %d\n", init); if (!init) return; init = false; - static Code code; -} catch (const Xbyak::Error& e) { - printf("err=%s\n", Xbyak::ConvertErrorToString(e)); + X::a.put(); } +