Skip to content

Imaginary types are not supported, violating ISO C Annex G #60269

@Keith-S-Thompson

Description

@Keith-S-Thompson

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__.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c11enhancementImproving things as opposed to bug fixing, e.g. new or missing featureobsoleteIssues with old (unsupported) versions of LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions