Title
Infinite recursion in constexpr functions
Status
c++11
Section
7.7 [expr.const]
Submitter
Jason Merrill

Created on 2010-08-01.00:00:00 last changed 96 months ago

Messages

Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting.]

Date: 2011-01-15.00:00:00

Proposed resolution (January, 2011):

Add the following bullet in 7.7 [expr.const] paragraph 2:

  • an invocation of a constexpr function or a constexpr constructor that would exceed the implementation-defined recursion limit (see annex Annex B [implimits]);

Date: 2010-11-15.00:00:00

Notes from the November, 2010 meeting:

The CWG was of mixed opinion as to whether an infinite recursion in a constexpr function should be ill-formed or simply render an expression non-constant.

Date: 2010-08-01.00:00:00

It is not clear what happens when a program violates the limits on constexpr function recursion in a context that does not require a constant expression. For example,

  constexpr int f(int i) { return f(i); }
  const int i = f(1);   // error, undefined behavior, or dynamic initialization?

(Presumably the “within its resource limits” caveat of 4.1 [intro.compliance] paragraph 2 would effectively result in undefined behavior in a context that required a constant expression.)

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3316
2011-04-10 00:00:00adminsetstatus: tentatively ready -> fdis
2011-02-28 00:00:00adminsetstatus: review -> tentatively ready
2010-11-29 00:00:00adminsetmessages: + msg3078
2010-11-29 00:00:00adminsetmessages: + msg3077
2010-11-29 00:00:00adminsetstatus: open -> review
2010-08-01 00:00:00admincreate