Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp0x/sfinae47.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // Source: Comment 16 of PR51213 |
2 // { dg-do compile { target c++11 } } | |
3 | |
4 template <class T> | |
5 T && declval(); | |
6 | |
7 template <class T> | |
8 constexpr auto hasSize(int) -> decltype(declval<T&>().size(), bool()) | |
9 { return true; } | |
10 | |
11 template <class T> | |
12 constexpr bool hasSize(...) | |
13 { return false; } | |
14 | |
15 struct A | |
16 { | |
17 int size(); | |
18 }; | |
19 | |
20 struct B : private A | |
21 { | |
22 }; | |
23 | |
24 static_assert(hasSize<A>(0), "A"); | |
25 static_assert(!hasSize<B>(0), "B"); |