EricWF added inline comments.

================
Comment at: test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp:42
+constexpr bool test0(int in1, int in2, int out)
 {
+    static_assert(std::is_same<Output, decltype(
----------------
BillyONeal wrote:
> EricWF wrote:
> > Nit but this seems much cleaner and more readable without the casts.
> > 
> > ```
> > auto value1 = static_cast<Input1>(in1);
> > auto value2 = static_cast<Input2>(in2);
> > static_assert(std::is_same_v<Output, decltype(std::gcd(value1, value2))>, 
> > "");
> > static_assert(std::is_same_v<Output, decltype(std::gcd(value2, value1))>, 
> > "");
> > assert(static_cast<Output>(out) == std::gcd(value1, value2));
> > return true;
> > ```
> > 
> > Also just use `assert` instead of `std::abort()`
> I was under the impression the abort dance was because assert isn't constexpr.
`assert` is constexpr for the exact same reason the `abort` dance was constexpr.

And I think somebody else was under the same misapprehension when they wrote 
this test.


https://reviews.llvm.org/D32309



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to