-
Bug
-
Resolution: Won't Fix
-
Not Prioritized
-
Code Generation Tools
-
CODEGEN-10583
-
-
default
-
After some investigation, this is determined to not be a compiler bug but is expected behavior.
The attached file has these lines ...
// Both of these should see error diagnostics, but only the second // one does Test::Compile_template<32>::a; Test::Compile_time<32 <= 1>::value;
Here is how Compile_time is implemented ...
template<bool b> struct Compile_time; template<> struct Compile_time<true> { static const uint16_t value = 0; }; // Because no specialization for Compile_time<false> is supplied, // any instantiation with a <false> input should result in a // compile time error.
Build it ...
% cl2000 --verbose_diagnostics file.cpp "file.cpp", line 22: error: incomplete type is not allowed static const bool b = Compile_time<32 <= 1>::value; ^ "file.cpp", line 30: warning: expression has no effect Test::Compile_template<32>::a; ^ "file.cpp", line 31: error: incomplete type is not allowed Test::Compile_time<32 <= 1>::value; ^ "file.cpp", line 34: warning: expression has no effect Test::Compile_template<1>::a; ^ "file.cpp", line 35: warning: expression has no effect Test::Compile_time<0 <= 1>::value; ^ 2 errors detected in the compilation of "file.cpp". >> Compilation failure
Ignore the warnings about expression has no effect. That's expected. The two errors issued are also expected. The problem is line 30 gets no error. It should, because it instantiates Compile_template with the value <32>, which in turn instantiates Compile_time with the expression <32 <= 1>.