F
Fedor Rodikov
After reading the [basic.lval] chapter in C++ standard I've written
the following simple test program to check my understanding:
int main()
{
int i;
(int(i)) = 0;
}
Here I try to assign a value to a temporary and this expression
compiles! But it shouldn't compile because we can't assign to r-value.
The C++standard in [basic.lval] says:
An expression which holds a temporary object resulting from a cast to
a nonreference is an rvalue (this includes the explicit creation of an
object using functional notation (5.2.3))
Where is inconsistency?
Thank you!
the following simple test program to check my understanding:
int main()
{
int i;
(int(i)) = 0;
}
Here I try to assign a value to a temporary and this expression
compiles! But it shouldn't compile because we can't assign to r-value.
The C++standard in [basic.lval] says:
An expression which holds a temporary object resulting from a cast to
a nonreference is an rvalue (this includes the explicit creation of an
object using functional notation (5.2.3))
Where is inconsistency?
Thank you!