Tool/software: TI C/C++ Compiler
Hello,
We started to verify CGT 8.3.7 and noticed following phenomena for this code:
int main() { constexpr char monthFromDate[] = { __DATE__[0], __DATE__[1], __DATE__[2], '\0' }; // Impossible if (monthFromDate[0] == 'G') { return 1; } return 0; }
Initially, it caused a flood of errors in our project:
"./main.cpp", line 4: error #28: expression must have a constant value
"./main.cpp", line 4: note #3062-D: attempt to access run-time storage
1 error detected in the compilation of "./main.cpp".
>> Compilation failure
Using "monthFromDate[4]" solved issue. GCC and CLANG compiles it without any problems, but we verified on Compiler's Explorer, that such code can cause the same problems, when Intel C++ Compiler is used (x86-64 icc 19.0.1). To keep portability, we would like to ensure, that this is not a bug, but rather implementation-defined behaviour. We are also curious about compiler's logic, which leads to this error.
Sample code with used command attached.ConstExprArrayTest.zip
Best Regards,
ZD