| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
// Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 4 |
// |
| 5 |
// This file is part of the GNU ISO C++ Library. This library is free |
| 6 |
// software; you can redistribute it and/or modify it under the |
| 7 |
// terms of the GNU General Public License as published by the |
| 8 |
// Free Software Foundation; either version 3, or (at your option) |
| 9 |
// any later version. |
| 10 |
// |
| 11 |
// This library is distributed in the hope that it will be useful, |
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
// GNU General Public License for more details. |
| 15 |
// |
| 16 |
// You should have received a copy of the GNU General Public License along |
| 17 |
// with this library; see the file COPYING3. If not see |
| 18 |
// <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
#include <type_traits> |
| 21 |
|
| 22 |
struct A { }; |
| 23 |
struct B : A { |
| 24 |
#if __cpp_aggregate_bases && __cpp_aggregate_paren_init |
| 25 |
// A user-declared constructor prevents B from being an aggregate. |
| 26 |
// Otherwise 'B&& b{A{}};' becomes valid in C++17 (__cpp_aggregate_bases), |
| 27 |
// and 'B&& b(A{});' becomes valid in C++17 (__cpp_aggregate_paren_init). |
| 28 |
B(); |
| 29 |
#endif |
| 30 |
}; |
| 31 |
|
| 32 |
// libstdc++/51185 |
| 33 |
void f() |
| 34 |
{ |
| 35 |
static_assert(!std::is_constructible<B &&, A>(), ""); |
| 36 |
static_assert(!std::is_constructible<B const &&, A>(), ""); |
| 37 |
static_assert(!std::is_constructible<B const &&, A const>(), ""); |
| 38 |
static_assert(!std::is_constructible<B volatile &&, A>(), ""); |
| 39 |
static_assert(!std::is_constructible<B volatile &&, A volatile>(), ""); |
| 40 |
static_assert(!std::is_constructible<B const volatile &&, A>(), ""); |
| 41 |
static_assert(!std::is_constructible<B const volatile &&, A const>(), ""); |
| 42 |
static_assert(!std::is_constructible<B const volatile &&, A volatile>(), ""); |
| 43 |
static_assert(!std::is_constructible<B const volatile &&, |
| 44 |
A const volatile>(), ""); |
| 45 |
} |