| 1 |
// Copyright (C) 2016-2025 Free Software Foundation, Inc. |
| 2 |
// |
| 3 |
// This file is part of the GNU ISO C++ Library. This library is free |
| 4 |
// software; you can redistribute it and/or modify it under the |
| 5 |
// terms of the GNU General Public License as published by the |
| 6 |
// Free Software Foundation; either version 3, or (at your option) |
| 7 |
// any later version. |
| 8 |
|
| 9 |
// This library is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU General Public License for more details. |
| 13 |
|
| 14 |
// You should have received a copy of the GNU General Public License along |
| 15 |
// with this library; see the file COPYING3. If not see |
| 16 |
// <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
// { dg-do compile { target c++17 } } |
| 19 |
|
| 20 |
#include <numeric> |
| 21 |
|
| 22 |
void |
| 23 |
test01() |
| 24 |
{ |
| 25 |
std::gcd(true, 1); // { dg-error "from here" } |
| 26 |
std::gcd(1, true); // { dg-error "from here" } |
| 27 |
std::gcd(true, true); // { dg-error "from here" } |
| 28 |
std::gcd<const bool, int>(true, 1); // { dg-error "from here" } |
| 29 |
std::gcd<int, const bool>(1, true); // { dg-error "from here" } |
| 30 |
std::gcd<const bool, const bool>(true, true); // { dg-error "from here" } |
| 31 |
std::gcd<const bool&, int>(true, 1); // { dg-error "from here" } |
| 32 |
std::gcd<int, const bool&>(1, true); // { dg-error "from here" } |
| 33 |
std::gcd<const bool&, const bool&>(true, true); // { dg-error "from here" } |
| 34 |
std::gcd<const volatile bool, int>(true, 1); // { dg-error "from here" } |
| 35 |
std::gcd<int, const volatile bool>(1, true); // { dg-error "from here" } |
| 36 |
std::gcd<const volatile bool, |
| 37 |
const volatile bool>(true, true); // { dg-error "from here" } |
| 38 |
std::gcd<volatile bool, int>(true, 1); // { dg-error "from here" } |
| 39 |
std::gcd<int, volatile bool>(1, true); // { dg-error "from here" } |
| 40 |
std::gcd<volatile bool, |
| 41 |
volatile bool>(true, true); // { dg-error "from here" } |
| 42 |
std::gcd(0.1, 1); // { dg-error "from here" } |
| 43 |
std::gcd(1, 0.1); // { dg-error "from here" } |
| 44 |
std::gcd(0.1, 0.1); // { dg-error "from here" } |
| 45 |
std::gcd<const int&, const int&>(0.1, 0.1); // { dg-error "from here" } |
| 46 |
} |
| 47 |
|
| 48 |
// { dg-error "must be integers" "" { target *-*-* } 0 } |
| 49 |
// { dg-error "must not be bool" "" { target *-*-* } 0 } |
| 50 |
// These prunes could be removed if a fix for PR c++/96286 stops them. |
| 51 |
// { dg-prune-output "deleted function" } |
| 52 |
// { dg-prune-output "incomplete type .*make_unsigned" } |
| 53 |
// { dg-prune-output "does not have integral type" } |
| 54 |
// { dg-prune-output "non-integral type" } |
| 55 |
// { dg-prune-output "invalid specialization" } |