digitalmars.D.bugs - [Issue 23622] New: ImportC fails to compile files which include math.h
- d-bugmail puremagic.com (50/50) Jan 12 2023 https://issues.dlang.org/show_bug.cgi?id=23622
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 = FP_NAN, FP_INFINITE = FP_INFINITE, FP_ZERO = FP_ZERO, FP_SUBNORMAL = FP_SUBNORMAL, FP_NORMAL = FP_NORMAL }; --
Jan 12 2023