Topic: Where in the C++11 standard does it specify when a constexpr function can be evaluated during translation?


Author: s.scott.schurr@googlemail.com
Date: Tue, 18 Dec 2012 16:06:15 CST
Raw View
On Saturday, December 15, 2012 10:54:25 AM UTC-8, Daniel Kr   gler wrote:
>  Am 14.12.2012 18:15, schrieb sschurr:
>  >  The heart of the question is this:
>  >
>  >  <quote>
>  >
>  >  I've been looking through the C++11 FDIS (N3242, available
>  >  at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/)
>  >  to try and determine two things:
>  >
>  >     o When is the compiler obligated to evaluate a constexpr
>  >       function during translation?
>  >
>  >     o When is the compiler allowed to evaluate a constexpr
>  >       function during translation?
>  >
>  >  [...snip...]
>
>  Answers to these questions are related to the context, in which a
>  constexpr function is used. I would like to warn you that the standard
>  itself is not a document that is written to answer such questions
>  directly. If you want to enumerate these cases, you have to read through
>  all the standard and have to find those places that impose such a
>  requirement. This is extremely hard work and I'm not willing to do that
>  at the moment ;-) But if you are willing to accept some general
>  conclusions this can lead to still useful rules of the thumb.

[snip a lot of very useful information]

Wow.  I'd like to express my thanks to Mr. Kr   gler for his extremely detailed and useful response.  I know that well thought out answers, like Mr. Kr   gler's, take a lot of time to compose.  It's great to have someone from inside the C++ standards community take the time to help innocents (like me) come up to speed.

Please accept my thanks and gratitude.

SSchurr


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]