| 1 |
// PR c++/50391 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
namespace std |
| 5 |
{ |
| 6 |
template<typename T, T Val> |
| 7 |
struct integral_constant |
| 8 |
{ static constexpr T value = Val; }; |
| 9 |
|
| 10 |
template<typename T> |
| 11 |
struct is_abstract |
| 12 |
: integral_constant<bool, __is_abstract(T)> |
| 13 |
{ }; |
| 14 |
|
| 15 |
template<typename T, bool = is_abstract<T>::value> |
| 16 |
struct is_destructible |
| 17 |
: integral_constant<bool, true> |
| 18 |
{ }; |
| 19 |
|
| 20 |
template<typename T> |
| 21 |
struct is_destructible<T, true> |
| 22 |
: integral_constant<bool, false> |
| 23 |
{ }; |
| 24 |
|
| 25 |
template<typename T> |
| 26 |
struct is_nothrow_move_constructible |
| 27 |
: is_destructible<T> |
| 28 |
{ }; |
| 29 |
|
| 30 |
template<typename T> |
| 31 |
struct decay |
| 32 |
{ typedef T type; }; |
| 33 |
|
| 34 |
template<typename T> |
| 35 |
struct decay<T&> |
| 36 |
{ typedef T type; }; |
| 37 |
|
| 38 |
} // std |
| 39 |
|
| 40 |
template<class Tp> |
| 41 |
struct single |
| 42 |
{ |
| 43 |
Tp elem; |
| 44 |
|
| 45 |
constexpr single(const Tp& e) |
| 46 |
: elem(e) { } |
| 47 |
|
| 48 |
single(single&& s) |
| 49 |
noexcept(std::is_nothrow_move_constructible<Tp>::value) |
| 50 |
: elem(s.elem) { } |
| 51 |
}; |
| 52 |
|
| 53 |
template<class Tp> |
| 54 |
constexpr single<typename std::decay<Tp>::type> |
| 55 |
make_single(Tp&& x) |
| 56 |
{ |
| 57 |
return single<typename std::decay<Tp>::type>(x); |
| 58 |
} |
| 59 |
|
| 60 |
class Blob; // { dg-message "forward declaration" } |
| 61 |
|
| 62 |
void |
| 63 |
foo(Blob *b) |
| 64 |
{ |
| 65 |
make_single(*b); |
| 66 |
} |
| 67 |
|
| 68 |
// { dg-excess-errors "incomplete type|not a member" } |