Clarification of converted constant expression definition

前端 未结 1 589
眼角桃花
眼角桃花 2021-01-19 16:03

(Following my recent question, and another question.)

[expr.const]/4 says that:

A converted constant expression of type T is an expression, im

相关标签:
1条回答
  • 2021-01-19 16:42

    First, which expression does "the converted expression" (emphased) refer to?

    Implicit conversion introduces a correspondingly initialized temporary:

    T e = /* original expression */;
    

    e is the "converted expression". T = int in your case.

    then which expression should be constant expression?

    e.

    Moreover, foo and the conversion operator function that has been implicitly invoked must be constexpr functions as per [expr.const]/(2.2).

    Second, what stage of the whole process does "reference binding" refer to?

    When T is a reference type, that reference - e in the above example - shall bind directly. No binding necessitated inside the expression or before it is of interest.

    0 讨论(0)
提交回复
热议问题