0

In the following example:

extern bool b1;
bool b2(b1);

The initializing expression b1 is an lvalue bool.

Is the lvalue-to-rvalue conversion applied to it to convert it to a prvalue before being used to initialize b2? Where is this stated in the standard?

Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319

1 Answers1

0

Yes, an lvalue-to-rvalue conversion is performed. The initialization of a non-reference non-class type by an expression of non-class type requires a prvalue.

This is difficult to determine explicitly from the standard text, except by supposing both cases and then realizing that an answer of no will break many of the other rules (see odr-use and constant expressions). The definition of converting an expression e to type T and initialization of a variable of type T by an expression e is almost circular between the preamble of clause 4 and clause 8.5.

Andrew Tomazos
  • 66,139
  • 40
  • 186
  • 319