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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs