| 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::lcm(true, 1); // { dg-error "from here" } |
| 26 | std::lcm(1, true); // { dg-error "from here" } |
| 27 | std::lcm(true, true); // { dg-error "from here" } |
| 28 | std::lcm<const bool, int>(true, 1); // { dg-error "from here" } |
| 29 | std::lcm<int, const bool>(1, true); // { dg-error "from here" } |
| 30 | std::lcm<const bool, const bool>(true, true); // { dg-error "from here" } |
| 31 | std::lcm<const bool&, int>(true, 1); // { dg-error "from here" } |
| 32 | std::lcm<int, const bool&>(1, true); // { dg-error "from here" } |
| 33 | std::lcm<const bool&, const bool&>(true, true); // { dg-error "from here" } |
| 34 | std::lcm<const volatile bool, int>(true, 1); // { dg-error "from here" } |
| 35 | std::lcm<int, const volatile bool>(1, true); // { dg-error "from here" } |
| 36 | std::lcm<const volatile bool, |
| 37 | const volatile bool>(true, true); // { dg-error "from here" } |
| 38 | std::lcm<volatile bool, int>(true, 1); // { dg-error "from here" } |
| 39 | std::lcm<int, volatile bool>(1, true); // { dg-error "from here" } |
| 40 | std::lcm<volatile bool, |
| 41 | volatile bool>(true, true); // { dg-error "from here" } |
| 42 | std::lcm(0.1, 1); // { dg-error "from here" } |
| 43 | std::lcm(1, 0.1); // { dg-error "from here" } |
| 44 | std::lcm(0.1, 0.1); // { dg-error "from here" } |
| 45 | std::lcm<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" } |