Title
Deleted constexpr functions
Status
c++11
Section
9.2.6 [dcl.constexpr]
Submitter
Daniel Kr├╝gler

Created on 2010-09-17.00:00:00 last changed 102 months ago

Messages

Date: 2011-03-15.00:00:00

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

Date: 2011-01-15.00:00:00

Proposed resolution (January, 2011):

  1. Change 9.2.6 [dcl.constexpr] paragraph 3 as follows:

    • ...

    • its function-body shall be = delete or a compound-statement of the form

        { return expression ; }
      
    • ...

  2. Change 9.2.6 [dcl.constexpr] paragraph 4 as follows:

  3. The definition of a constexpr constructor In the definition of a constexpr constructor, each of the parameter types shall be a literal type or a reference to a literal type. In addition, either its function-body shall be = delete or it shall satisfy the following constraints:

    • each of its parameter types shall be a literal type or a reference to literal type;

    • ...

Date: 2010-09-17.00:00:00

The current requirements for constexpr functions do not permit a deleted constexpr function because the definition does not consist of a compound-statement containing just a return statement. However, it could be useful to allow this form in a case where a single piece of code is used in multiple configurations, in some of which the function is constexpr and others deleted; having to update all declarations of the function to remove the constexpr specifier is unnecessarily onerous.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3331
2011-04-10 00:00:00adminsetstatus: tentatively ready -> fdis
2011-02-28 00:00:00adminsetmessages: + msg3228
2011-02-28 00:00:00adminsetstatus: drafting -> tentatively ready
2010-11-29 00:00:00adminsetstatus: open -> drafting
2010-09-17 00:00:00admincreate