LINUX.ORG.RU

История изменений

Исправление Dendy, (текущая версия) :

Спасибо. Как я понимаю, таки пример выше соответствует стандарту. Вообще я читал N2235.

7.1.6

A constexpr specifier used in a function declaration declares that func- tion to be a constexpr function. Similarly, a constexpr specifier used in a constructor declaration declares that constructor to be a constexpr constructor. Constexpr functions and constexpr constructors are im- plicitly inline (7.1.2). A constexpr function shall not be virtual (10.3).

The definition of a constexpr function shall satisfy the following con- straints: — its return type shall be a literal type; and — its parameter types shall be literal types; and — its function-body shall be a compound-statement of the form { return expression; } where expression is a potential constant expression (5.19); and — every implicit conversion used in converting expression to the func- tion return type (8.5) shall be one of those allowed in a constant expression (5.19).

Исходная версия Dendy, :

Спасибо. Как я понимаю, таки пример выше соответствует стандарту. Вообще я читал N2235.

7.1.6

A constexpr specifier used in a function declaration declares that func-
tion to be a constexpr function. Similarly, a constexpr specifier used in
a constructor declaration declares that constructor to be a constexpr
constructor. Constexpr functions and constexpr constructors are im-
plicitly inline (7.1.2). A constexpr function shall not be virtual (10.3).

The definition of a constexpr function shall satisfy the following con-
straints:
— its return type shall be a literal type; and
— its parameter types shall be literal types; and
— its function-body shall be a compound-statement of the form
{ return expression; }
where expression is a potential constant expression (5.19); and
— every implicit conversion used in converting expression to the func-
tion return type (8.5) shall be one of those allowed in a constant
expression (5.19).