Title
constexpr function requirements and class scope
Status
nad
Section
9.2.6 [dcl.constexpr]
Submitter
Jason Merrill

Created on 2011-05-12.00:00:00 last changed 141 months ago

Messages

Date: 2011-08-15.00:00:00

Rationale (August, 2011):

The requirements apply to definitions, not declarations.

Date: 2022-11-20.07:54:16

A constexpr function is required to have literal argument and return types. Consider an example like:

  template <class T> struct B {
    constexpr B(T) { }
  };

  struct A {
    B<A> b;
  };

Whether B(A) is constexpr depends on whether A is literal, which depends on whether B<A> is literal, which depends on whether B(A) is constexpr.

History
Date User Action Args
2012-09-24 00:00:00adminsetmessages: + msg4023
2011-05-12 00:00:00admincreate