annotate gcc/testsuite/g++.dg/cpp0x/decltype12.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 // { dg-do compile { target c++11 } }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 // { dg-additional-options "-Wno-return-type" }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3
111
kono
parents:
diff changeset
4 template<typename T, typename U>
kono
parents:
diff changeset
5 struct is_same
kono
parents:
diff changeset
6 {
kono
parents:
diff changeset
7 static const bool value = false;
kono
parents:
diff changeset
8 };
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 template<typename T>
kono
parents:
diff changeset
11 struct is_same<T, T>
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 static const bool value = true;
kono
parents:
diff changeset
14 };
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 int&& f(const int&) {}
kono
parents:
diff changeset
17 int&& (*fp)(const int&) = f;
kono
parents:
diff changeset
18 int&& (&fr)(const int&) = f;
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 struct X { int&& f(const int&); };
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 int&& (X::*mfp)(const int&) = &X::f;
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 void g(X& xr, X* xp)
kono
parents:
diff changeset
25 {
kono
parents:
diff changeset
26 int i;
kono
parents:
diff changeset
27 static_assert(is_same<decltype(f(i)), int&&>::value, "direct call");
kono
parents:
diff changeset
28 static_assert(is_same<decltype(fp(i)), int&&>::value, "pointer");
kono
parents:
diff changeset
29 static_assert(is_same<decltype((*fp)(i)), int&&>::value,
kono
parents:
diff changeset
30 "dereferenced pointer");
kono
parents:
diff changeset
31 static_assert(is_same<decltype(fr(i)), int&&>::value,
kono
parents:
diff changeset
32 "reference");
kono
parents:
diff changeset
33 static_assert(is_same<decltype(xr.f(i)), int&&>::value,
kono
parents:
diff changeset
34 "member function call");
kono
parents:
diff changeset
35 static_assert(is_same<decltype((xr.*mfp)(i)), int&&>::value,
kono
parents:
diff changeset
36 "member function pointer with .*");
kono
parents:
diff changeset
37 static_assert(is_same<decltype((xp->*mfp)(i)), int&&>::value,
kono
parents:
diff changeset
38 "member function pointer with ->*");
kono
parents:
diff changeset
39 }