I added C++ template metaprogramming(TMP) backend.
You can test this backend by the following command:
$ CPP_TEMPLATE=1 make cpp_template
This backend generates a C++ program that performs a compile-time computation like C++14 constexpr backend.
However, TMP is much more restricted than C++14 constexpr.
The largest restriction is that a huge amount of memory is needed to compile a program generated by this backend.
For example, g++ uses about 3GB memory to compile a C++ template program translated from a simple program:
I added C++ template metaprogramming(TMP) backend. You can test this backend by the following command:
This backend generates a C++ program that performs a compile-time computation like C++14 constexpr backend. However, TMP is much more restricted than C++14 constexpr.
The largest restriction is that a huge amount of memory is needed to compile a program generated by this backend. For example,
g++
uses about 3GB memory to compile a C++ template program translated from a simple program:The more complex program you want to run, the more memory is needed. Thus, unfortunately, 8cc translated by this backend does not work at all.