You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to TS 18661-3 X.2.1p3: "Each interchange floating type is not compatible with any other type." so I can confirm that this is incorrect in Clang.
So this is not actually a Clang bug, we don't claim to support TS 18661-3 (we don't define __STDC_IEC_60559_TYPES). You can verify this yourself by doing a -E compilation and noting where the typedef comes from. For me, that's:
Extended Description
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;
}
The text was updated successfully, but these errors were encountered: