Imaginary types are not supported, violating ISO C Annex G · Issue #60269 · llvm/llvm-project (original) (raw)
This program:
#include <stdio.h> #include <complex.h> int main(void) { #ifdef STDC_IEC_559_COMPLEX printf("STDC_IEC_559_COMPLEX is defined as %d\n", STDC_IEC_559_COMPLEX); #else printf("STDC_IEC_559_COMPLEX is NOT defined\n"); #endif
#ifdef _Imaginary_I printf("Imaginary types are supported\n"); #else printf("Imaginary types are NOT supported\n"); #endif }
compiled with clang -Wall -Wextra -std=c11 -pedantic-errors
(llvm version 15.0.0) produces this output:
STDC_IEC_559_COMPLEX is defined as 1 Imaginary types are NOT supported
ISO C Annex G was informative in C99, but was made normative in C11.
Imaginary types are optional in C11, but are mandatory for any
implementation that predefines __STDC_IEC_559_COMPLEX__
.
(Complex types were made optional in C11, but that's not relevant here.)
To conform to C11 (and later), clang should either implement imaginary types
as defined in Annex G or remove the definition of __STDC_IEC_559_COMPLEX__
.