The following 4-lines source fragment test.c (fourth line empty) #if 0?0?0:0:0 #endif int main(void){return 0?0?0:0:0;} cause: test.c(1) : fatal error C1017: invalid integer constant expression when compiled by cl.exe aka "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86". On the other hand this compile and runs fine. #if 0?(0?0:0):0 #endif int main(void){return 0?0?0:0:0;} Did I hit a but it this compiler's preprocessor? Francois Grieu
On 3/30/2010 12:47 PM, Francois Grieu wrote: > The following 4-lines source fragment test.c (fourth line empty) > #if 0?0?0:0:0 > #endif > int main(void){return 0?0?0:0:0;} > > cause: > test.c(1) : fatal error C1017: invalid integer constant expression > when compiled by cl.exe aka "Microsoft (R) 32-bit C/C++ Optimizing > Compiler Version 15.00.30729.01 for 80x86". > > On the other hand this compile and runs fine. > #if 0?(0?0:0):0 > #endif > int main(void){return 0?0?0:0:0;} > > > Did I hit a but it this compiler's preprocessor? Looks like ig. -- Eric Sosman esosman@ieee-dot-org.invalid
![]() |
0 |
![]() |
Eric Sosman wrote: > On 3/30/2010 12:47 PM, Francois Grieu wrote: >> The following 4-lines source fragment test.c (fourth line empty) >> #if 0?0?0:0:0 >> #endif >> int main(void){return 0?0?0:0:0;} >> >> cause: >> test.c(1) : fatal error C1017: invalid integer constant expression >> when compiled by cl.exe aka "Microsoft (R) 32-bit C/C++ Optimizing >> Compiler Version 15.00.30729.01 for 80x86". >> >> On the other hand this compile and runs fine. >> #if 0?(0?0:0):0 >> #endif >> int main(void){return 0?0?0:0:0;} >> >> >> Did I hit a but it this compiler's preprocessor? > > Looks like ig. > No it is a case of a TA.
![]() |
0 |
![]() |
I wrote: > The following 4-lines source fragment test.c (fourth line empty) > #if 0?0?0:0:0 > #endif > int main(void){return 0?0?0:0:0;} > > cause: > test.c(1) : fatal error C1017: invalid integer constant expression > when compiled by cl.exe aka "Microsoft (R) 32-bit C/C++ Optimizing > Compiler Version 15.00.30729.01 for 80x86". > > On the other hand this compile and runs fine. > #if 0?(0?0:0):0 > #endif > int main(void){return 0?0?0:0:0;} > > > Did I hit a bug in this compiler's preprocessor? The consensus is yes. I duly reported it. And the (representative of) the compiler vendor says: "We were able to reproduce this issue. But Unfortunately we will not fix this issue as it is not a common code and is not a high priority issue. Thanks for playing with our product." https://connect.microsoft.com/VisualStudio/feedback/details/546053/if-1-1-1-1-1-cause-error-fatal-error-c1017-with-c-compiler-16-00-30128-01 I should probably have reported the problem as: // return the smallest of x y z #define MIN3(x,y,z) ( (x)>(y) ? (y)>(z) ? (z) : (y) : (x) ) #define ALPHA 5 #define BETA 4 #define GAMMA 6 #if MIN3(ALPHA,BETA,GAMMA) < 2 #error "check ALPHA BETA GAMMA" #endif int main(void){return 0?0?0:0:0;} Francois Grieu
![]() |
0 |
![]() |