2011/8/19 Timon Gehr <timon.g...@gmx.ch>: > Oh, interesting. So why were they implemented with different semantics then?
I don't know the background, sorry. > Also, how would they work in a non-templated function? In my opinion, that might work like C++ const T&, that allows receiving a rvalue argument. > Would they just be conservatively treated as rvalues in the function body? Maybe it doesn't. In D, a variable is always treated as lvalue, even if it is a parameter. The follows are my opinion: D might be designed as which ref parameter receives only lvalue, and non-ref parameter receives only rvalue. Today ref storage class also means that the parameter binds corresponding argument by reference, but it is not a language design, but that is performance decision. It seems to me that ref storage class is designed for automatic move semantics. According to my think, struct literal should be rvalue. That is temporary, and we want to move it automatically. Kenji Hara