This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: hypot error : '__builtin_choose_expr' requires a constant expression
- From: "Jon Beniston" <jon at beniston dot com>
- To: "'Chunxia Du'" <duchunxia at 163 dot com>, "'newlib'" <newlib at sourceware dot org>
- Date: Fri, 29 Jun 2018 09:42:54 +0100
- Subject: RE: hypot error : '__builtin_choose_expr' requires a constant expression
- References: <11eba3d1.4c61cf.164496115b9.Coremail.duchunxia@163.com>
Hi Chunxia,
What compiler, target and version? It compiles ok for me.
Regards,
Jon
-----Original Message-----
From: newlib-owner@sourceware.org [mailto:newlib-owner@sourceware.org] On
Behalf Of Chunxia Du
Sent: 29 June 2018 03:31
To: newlib
Subject: hypot error : '__builtin_choose_expr' requires a constant
expression
Hi All,I got errors when I tried to use the function hypot. It said "
'__builtin_choose_expr' requires a constant expression". I found the error
occurs at "__tg_integer" in tgmath.h. It does not treat
"(__typeof__(__e1))1.5 == 1" as a constantexpression. I am confused that why
it's not a constant expression, and how should I fix this.
The code is as follows:
#include <tgmath.h>
int main()
{
double __complex__ z = 0.0;
hypot(__real__ z, __imag__ z);
return 0;
}
Looking forward to your reply!
Thanks and Regards,
Chunxia Du