<p dir="ltr"><br>
On 9 Sep 2013 20:40, "fil" <<a href="mailto:fil@pobox.com">fil@pobox.com</a>> wrote:<br>
><br>
> Richard Smith wrote<br>
> >> 1. know of a way to use builtin functions (like clz) in a constexpr<br>
> >> context?<br>
> >> I am figuring I need to re-implement it, no way to use the CPU<br>
> >> instruction<br>
> >> at compile time (?)<br>
> >><br>
> ><br>
> > __builtin_clz works in constant expressions in recent Clang revisions. You<br>
> > only need to upgrade =)<br>
><br>
> Right.. good to know. Did this change come in 3.3 or very latest SVN?</p>
<p dir="ltr">Sorry, I don't remember. Maybe someone with 3.3 can test this for you. I think it was more recently than that, though.</p>
<p dir="ltr">> Richard Smith wrote<br>
> > 2. why does a branch allow it to be compiled? I would have thought that<br>
> > the<br>
> >> compiler would inspect both branches and insist they both be a const<br>
> >> friendly.<br>
> ><br>
> > The compiler does inspect both branches, but it only insists that *one* of<br>
> > them is constexpr-friendly. It's valid for a ?: to select between a<br>
> > potentially-constant expression and a never-constant expression within a<br>
> > constexpr function.<br>
><br>
> Gotcha. I expected it to be a bit more draconian on guaranteeing constexpr<br>
> in all branches. Thx for the follow up.<br>
><br>
> Regards, Fil.<br>
><br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/constexpr-with-builtin-tp4034336p4034358.html">http://clang-developers.42468.n3.nabble.com/constexpr-with-builtin-tp4034336p4034358.html</a><br>
> Sent from the Clang Developers mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</p>