[llvm-bugs] [Bug 39858] New: Compound assignment in constexpr function treated as ill-formed if LHS is an int and RHS is a floating point type
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Dec 1 17:01:06 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39858
Bug ID: 39858
Summary: Compound assignment in constexpr function treated as
ill-formed if LHS is an int and RHS is a floating
point type
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: yaghmour.shafik at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Given the following example from this Stack Overflow question
https://stackoverflow.com/q/53570652/1708801
template<class A, class B> constexpr int f(A a, B b) {
a /= b;
return a;
}
constexpr int x = f(2, 2); // a, b: int
constexpr int y = f(2., 2.); // a, b: double
constexpr int z = f(2, 2.); // a: int, b: double //<-- BOOM!
constexpr int w = f(2., 2); // a: double, b: int
int main() {}
The line initialization of z is treated as ill-formed but there is nothing in
[dcl.constexpr]p3 or [expr.const] that would seem to make this case different
than the rest, so this looks like a bug.
--
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/20181202/4c75db36/attachment.html>
More information about the llvm-bugs
mailing list