[llvm-bugs] [Bug 37848] New: sinh vs asinh vs constexpr
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 19 03:35:25 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37848
Bug ID: 37848
Summary: sinh vs asinh vs constexpr
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
The code is as follow:
namespace std {
constexpr double asinh (double x) { return __builtin_asinh (x); }
}
int main()
{
constexpr double das = std::asinh(1.0);
}
clang++ produces errors:
error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr double asinh (double x) { return __builtin_asinh (x); }
note: subexpression not valid in a constant expression
constexpr double asinh (double x) { return __builtin_asinh (x); }
error: constexpr variable 'das' must be initialized by a constant expression
constexpr double das = std::asinh(1.0);
g++ accepts the above code. The code comes from a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49813
The report has a long discussion on this issue. Please check the report. It
seems to be a bug in clang++.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180619/e1e7e8d3/attachment-0001.html>
More information about the llvm-bugs
mailing list