[libcxx-bugs] compile-time expression in run-time evaluation

Louis Dionne via libcxx-bugs libcxx-bugs at lists.llvm.org
Mon Jan 27 11:12:07 PST 2020


We can’t use `if constexpr` there, since `__i` is not a constant expression from within the function. So `__matches[__i]` is not a constant expression.

It doesn’t matter though, since the function `__find_index` will always result in a constant expression, and so we wouldn’t gain anything from using `if constexpr` there.

Louis

> On Jul 18, 2019, at 04:27, vali asdas via libcxx-bugs <libcxx-bugs at lists.llvm.org> wrote:
> 
> Hey there,
> 
> Line 322 here llvm-mirror/libcxx <https://github.com/llvm-mirror/libcxx/blob/master/include/variant> is an if with a constant expression inside. Shouldn't it be using if constexpr? It should be a direct replacement, since if constexpr and std::variant are both from C++ 17 anyway.Thanks.
> 
> 	
> llvm-mirror/libcxx
> Mirror of official libcxx git repository located at http://llvm.org/git/libcxx. Updated every five minutes. - ll...
>  <https://github.com/llvm-mirror/libcxx/blob/master/include/variant>
> 
> 
> _______________________________________________
> libcxx-bugs mailing list
> libcxx-bugs at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-bugs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-bugs/attachments/20200127/ec0ef5ae/attachment-0001.html>


More information about the libcxx-bugs mailing list