[PATCH] D24158: Try contextually converting condition of constexpr if to Boolean value
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 6 19:06:40 PDT 2016
rsmith added inline comments.
================
Comment at: test/CodeGenCXX/cxx1z-constexpr-if.cpp:26-29
@@ -17,2 +25,6 @@
}
+ if constexpr (A())
+ should_be_used_3();
+ else
+ should_not_be_used();
}
----------------
Please also add a test that we reject expressions that are contextually convertible to a `bool` constant expression but are not contextually converted constant expressions of type `bool`. Example:
if constexpr (4.3) // ill-formed, boolean conversion not permitted
... and sadly ...
constexpr void *p = nullptr;
if constexpr (p) // ill-formed, boolean conversion not permitted
https://reviews.llvm.org/D24158
More information about the cfe-commits
mailing list