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

Louis Dionne via libcxx-bugs libcxx-bugs at lists.llvm.org
Mon Jan 27 13:16:32 PST 2020



> On Jan 27, 2020, at 11:35, vali asdas <vali.asdas at yahoo.ro> wrote:
> 
> Hi. So why put constexpr at 319?

It’s not needed but it doesn’t hurt.

Louis

> 
> Pe luni, 27 ianuarie 2020, 21:12:21 EET, Louis Dionne <ldionne at apple.com> a scris:
> 
> 
> 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 <mailto: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 <mailto: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/bc678c85/attachment-0001.html>


More information about the libcxx-bugs mailing list