C++ Logo

std-discussion

Advanced search

Re: How do I know whether a call to a constexpr standard library function is actually a constant expression?

From: Brian Bi <bbi5291_at_[hidden]>
Date: Fri, 15 Nov 2019 15:54:46 -0600
On Fri, Nov 15, 2019 at 3:53 PM Thiago Macieira <thiago_at_[hidden]> wrote:

> On sexta-feira, 15 de novembro de 2019 13:00:44 PST Brian Bi wrote:
> > > What do you mean by "constexpr context"?
>
> constexpr or constinit variable initialisation, template parameters, size
> of
> arrays (aside from Variable Length Arrays), etc.
>
> > > Why does it matter?
> >
> > It matters because it determines whether:
> >
> > constexpr auto x = some_constexpr_library_function(some_args)
> >
> > actually compiles.
>
> If the standard says the function is constexpr, some_args are constant
> expression too, then it compiles.
>

If that is actually the rule, it should be written down explicitly in the
standard.


>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel System Software Products
>
>
>
>

-- 
*Brian Bi*

Received on 2019-11-15 15:57:17