Question about references

Why does the following compile in VC++11:

int const& val = 5+5;

What does this mean? Specifically, where is the reference pointing?
There is no great sense in this declaration. It would be simpler to write

const int val = 10;

The statement you showed means that the reference will reference the rvalue of expression 5+5.
Ah ok, I really should read up about this lvalue/rvalue business. Thanks.
Topic archived. No new replies allowed.