annotate gcc/testsuite/g++.dg/cpp0x/iop.C @ 131:84e7813d76e9

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