January 12, 2023 [Issue 23622] New: ImportC fails to compile files which include math.h | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23622 Issue ID: 23622 Summary: ImportC fails to compile files which include math.h Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: ImportC Severity: normal Priority: P3 Component: dmd Assignee: nobody@puremagic.com Reporter: krzysztof.jajesnica@student.put.poznan.pl The following C code fails to compile with DMD 2.101.1: #include <math.h> float norm2D(float x, float y) { return sqrt(x*x + y*y); } DMD error message: #defines(1074): Error: variable `vec_math.FP_NAN` conflicts with enum member `__anonymous.FP_NAN` at /usr/include/math.h(936) #defines(1075): Error: variable `vec_math.FP_INFINITE` conflicts with enum member `__anonymous.FP_INFINITE` at /usr/include/math.h(939) #defines(1076): Error: variable `vec_math.FP_ZERO` conflicts with enum member `__anonymous.FP_ZERO` at /usr/include/math.h(942) #defines(1077): Error: variable `vec_math.FP_SUBNORMAL` conflicts with enum member `__anonymous.FP_SUBNORMAL` at /usr/include/math.h(945) #defines(1078): Error: variable `vec_math.FP_NORMAL` conflicts with enum member `__anonymous.FP_NORMAL` at /usr/include/math.h(948) The problem seems to be caused by this strange enum declaration in math.h: enum { FP_NAN = # define FP_NAN 0 FP_NAN, FP_INFINITE = # define FP_INFINITE 1 FP_INFINITE, FP_ZERO = # define FP_ZERO 2 FP_ZERO, FP_SUBNORMAL = # define FP_SUBNORMAL 3 FP_SUBNORMAL, FP_NORMAL = # define FP_NORMAL 4 FP_NORMAL }; -- |
Copyright © 1999-2021 by the D Language Foundation