https://bugs.llvm.org/show_bug.cgi?id=50766

            Bug ID: 50766
           Summary: in C double and _Float64 mist be destinct types (and
                    float and _Float32)
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

In C double and _Float64 are destinct types always.

In C float and _Float32 are destinct types always.

In _Float32 must NOT promote to double.

I have the definitive response from the sc22wg14 mailing list confirming
above statements.

Since the mailing list is not public I cannot sent the answer here.

x86-64 clang 12.0.0, icc 19.01 and tcc (unknown version) fail to compile
following program, but gcc 9.2.1 succeeds:


#include <stdio.h>
#include <math.h>

#define PGFN(name) _Generic((name), \
     float:   printf("%s():" #name "=%f\n",__func__,name),       \
     double:  printf("%s():" #name "=%f\n",__func__,name),       \
     default: printf("%s():" #name "=[unknown type]\n",__func__),\
     _Float32:printf("%s():" #name "=%f\n",__func__,((double)name)),       \
     _Float64:printf("%s():" #name "=%f\n",__func__,name)        \
     )

int main(int argc,char *argv[]){
     float f=4.0;
     double d=8.0;
     _Float32 f32=32.0;
     _Float64 f64=64.0;
     (void)argc,(void)argv;
     PGFN(f);
     PGFN(d);
     PGFN(f32);
     PGFN(f64);
     return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to