On Fri, Jun 2, 2017 at 3:19 PM, Tim Shen <tims...@google.com> wrote: > On Fri, Jun 2, 2017 at 6:07 AM, Jonathan Wakely wrote: >> As the PR points out, we aren't qualifying calls to __ref_cast, and >> have 'constexpr' on function templates that can never be usable in >> constant expressions. > > Apology for the constexpr trolling, but that was not intentional. :) > > I'm curious why no tests break. Is it because constexpr in a template > function is a no-op instead of a hard error, when the function > definition is not constexpr? > > The patch looks good. >
A non-template, non-default constexpr function that can never be used in a constant expression is ill-formed NDR. ([dcl.constexpr]/5) A constexpr function template for which no specialization that satisfies the requirements for a constexpr function (when considered as a non-template) can be generated is ill-formed NDR. ([dcl.constexpr]/6) It's not really clear to me whether the second rule incorporates the first or if it's just talking about the requirements in [dcl.constexpr]/3, but regardless it's not required to break.