Title
Declarations in constexpr functions
Status
c++11
Section
9.2.6 [dcl.constexpr]
Submitter
Daniel Krügler

Created on 2009-05-09.00:00:00 last changed 131 months ago

Messages

Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3268.]

Date: 2009-07-15.00:00:00

Rationale (July, 2009):

This suggestion needs a proposal and analysis by EWG before it can be considered by CWG.

Date: 2022-11-20.07:54:16

According to 9.2.6 [dcl.constexpr] paragraph 3, no declarations are permitted in the body of a constexpr function. This seems overly restrictive. At least three kinds of declarations would seem to be helpful in writing such functions: static_assert, typedef and alias declarations, and local automatic variables initialized with constant expressions. (Similar considerations apply to lambdas in which the lambda-return-type-clause is omitted.)

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3327
2011-04-10 00:00:00adminsetstatus: extension -> fdis
2009-08-03 00:00:00adminsetmessages: + msg2282
2009-08-03 00:00:00adminsetstatus: open -> extension
2009-05-09 00:00:00admincreate