blob: 1058a2864c33e9dfdca89453c96a5cf686175506 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Source: Comment 16 of PR51213
// { dg-do compile { target c++11 } }
template <class T>
T && declval();
template <class T>
constexpr auto hasSize(int) -> decltype(declval<T&>().size(), bool())
{ return true; }
template <class T>
constexpr bool hasSize(...)
{ return false; }
struct A
{
int size();
};
struct B : private A
{
};
static_assert(hasSize<A>(0), "A");
static_assert(!hasSize<B>(0), "B");
|