1// I, Howard Hinnant, hereby place this code in the public domain. 2 3// Test that the implicit object parameter is *not* an rvalue reference, but is instead 4// identical to that specified in C++03. That is, the implicit object parameter is 5// an lvalue reference that can bind to an rvalue. :-\ 6// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html under the 7// section "Revision 1 Summary and Rationale" for more details. 8 9// { dg-do compile { target c++11 } } 10// { dg-skip-if "packed attribute missing for struct one" { "epiphany-*-*" } { "*" } { "" } } 11 12template <bool> struct sa; 13template <> struct sa<true> {}; 14 15struct one {long x[1];}; 16struct two {long x[2];}; 17 18struct os 19{ 20 one operator<<(int); 21}; 22 23struct A 24{ 25 A(int); 26}; 27 28two operator<<(os&, const A&); 29 30void test() 31{ 32 os o; 33 sa<sizeof(o << 1) == 1 * sizeof(long)> t1; // Calls os::operator<<(int) 34 // Would be ambiguous if the implicit object parameter 35 // was an rvalue reference. 36} 37 38int main() 39{ 40 return 0; 41} 42