Does this temp have l-value?


This piece of code compiles.

class A{};
void TestTemp()
{
  A() = A();
  //A *p = &A();
}

Does this mean the A() has l-value?
It’s not, and this can be proved by the line commented out, with error “requires l-value”.
The first line compiles only because the compiler makes an default operator= for A.

Advertisements
Comments are closed.
%d bloggers like this: