You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A converted constant expression of type T is an expression, implicitly converted to type T, where the converted expression is a constant expression and the implicit conversion sequence contains only.
[...]
integral conversions other than narrowing conversions,
[...]
and where the reference binding (if any) binds directly.
A contextually converted constant expression of type bool is an expression, contextually converted to bool ([conv]), where the converted expression is a constant expression and the conversion sequence contains only the conversions above.
I don't know which conversion does the emphasized word refer to. Does it refer to the conversions listed in above? Obviously, the value of sizeof(double) converted to bool is narrowing conversion, which violates integral conversions other than narrowing conversions, however, it does allow. If we say "the conversions above" refers to Boolean conversions, but user-defined conversion is also allowed at #1. It seems "the conversions above" is vague here. contextually converted constant expression of type bool is introduced by CWG2039, it claims that
This allows the expression to have any type that can be converted to bool, which is too lenient; it should instead say something like “a converted constant expression of type bool (7.7 [expr.const]).” This would include the conversion to bool in the determination of whether the expression is constant or not and would also disallow narrowing conversions.
However, the behavior that "contextually converted constant expression of type bool" permits is different from that for "converted constant expression of type bool", #3 proves that.
The text was updated successfully, but these errors were encountered:
[expr.const] p10 says
I don't know which conversion does the emphasized word refer to. Does it refer to the conversions listed in above? Obviously, the value of
sizeof(double)
converted to bool is narrowing conversion, which violates integral conversions other than narrowing conversions, however, it does allow. If we say "the conversions above" refers to Boolean conversions, but user-defined conversion is also allowed at#1
. It seems "the conversions above" is vague here. contextually converted constant expression of type bool is introduced by CWG2039, it claims thatHowever, the behavior that "contextually converted constant expression of type bool" permits is different from that for "converted constant expression of type bool",
#3
proves that.The text was updated successfully, but these errors were encountered: