LINUX.ORG.RU

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

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

Как я понимаю, в http://eel.is/c draft/expr.const#5 определяется «converted constant expression of type T». Там же, собственно

where the converted expression is a constant expression and the implicit conversion sequence contains only

  • integral conversions other than narrowing conversions,

Однако ниже доопределяется для T = bool:

A contextually converted constant expression of type bool is an expression, contextually converted to bool, where the converted expression is a constant expression and the conversion sequence contains only the conversions above.

А тут часть о «where the converted expression...» говорит, что само expression (до того как преобразовать его в bool) должно следовать справилам «converted constant expression of type T». А преобразование к bool должно быть contextual: http://eel.is/c draft/conv#def:conversion,contextual_to_bool

An expression e appearing in such a context is said to be contextually converted to bool and is well-formed if and only if the declaration bool t(e); is well-formed, for some invented temporary variable t ([dcl.init]).

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

Как я понимаю, в http://eel.is/c draft/expr.const#5 определяется «converted constant expression of type T». Там же, собственно

where the converted expression is a constant expression and the implicit conversion sequence contains only

  • integral conversions other than narrowing conversions,

Однако ниже доопределяется для T = bool:

A contextually converted constant expression of type bool is an expression, contextually converted to bool, where the converted expression is a constant expression and the conversion sequence contains only the conversions above.

А тут часть о «where the converted expression...» говорит, что само expression (до того как преобразовать его в bool) должно следовать справилам «converted constant expression of type T». А преобразование к bool должно быть contextual: http://eel.is/c draft/conv#def:conversion,contextual_to_bool

An expression e appearing in such a context is said to be contextually converted to bool and is well-formed if and only if the declaration bool t(e); is well-formed, for some invented temporary variable t ([dcl.init]).