fredoverflow
fredoverflow

Reputation: 263118

Do rvalue references allow implicit conversions?

Is the following code legal?

std::string&& x = "hello world";

g++ 4.5.0 compiles this code without any problems.

Upvotes: 6

Views: 697

Answers (1)

Johannes Schaub - litb
Johannes Schaub - litb

Reputation: 506965

This is discussed on usenet currently. See Rvalue reference example in 8.5/3 correct or wrong?.

It's not legal.

Upvotes: 5

Related Questions