Hello everyone,
I'm having problems with what appears to be a compiler error. I have created a structure which allows to detect compiling errors, because when the template parameter is evalueted as true is implemented, and when it is false is only declared, so it launch "error #71: incomplete type is not allowed". This is already working, but if I call it inside a template, is compiling when it shouldn't.
I'm attaching the project where it can be tested. The code is as follows:
#include <stdint.h> namespace Test { template<bool b> struct Compile_time; template<> struct Compile_time<true> { static const uint16_t value = 0; }; template <uint16_t nbits> struct Compile_template { static const bool a = Compile_time<nbits <= 1>::value; static const bool b = Compile_time<32 <= 1>::value; //< This don't compiles (Compiler working) }; } int main(void) { /// Should fail Test::Compile_template<32>::a; //< This compiles (Compiler ISSUE) Test::Compile_time<32 <= 1>::value; //< This don't compiles (Compiler working) /// Should compile Test::Compile_template<1>::a; //< This compiles (Compiler working) Test::Compile_time<0 <= 1>::value; //< This compiles (Compiler working) return 0; }