]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++11 } } |
a7543cfd | 2 | // { dg-require-cstdint "" } |
4acedca1 CF |
3 | |
4 | // 2008-07-03 Chris Fairles <chris.fairles@gmail.com> | |
5 | ||
7adcbafe | 6 | // Copyright (C) 2008-2022 Free Software Foundation, Inc. |
4acedca1 CF |
7 | // |
8 | // This file is part of the GNU ISO C++ Library. This library is free | |
9 | // software; you can redistribute it and/or modify it under the | |
10 | // terms of the GNU General Public License as published by the | |
748086b7 | 11 | // Free Software Foundation; either version 3, or (at your option) |
4acedca1 CF |
12 | // any later version. |
13 | ||
14 | // This library is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | ||
19 | // You should have received a copy of the GNU General Public License | |
748086b7 JJ |
20 | // along with this library; see the file COPYING3. If not see |
21 | // <http://www.gnu.org/licenses/>. | |
4acedca1 CF |
22 | |
23 | #include <ratio> | |
24 | ||
4acedca1 CF |
25 | void |
26 | test01() | |
27 | { | |
879e1011 PC |
28 | std::ratio_add<std::ratio<INTMAX_MAX, 1>, std::ratio<1>>::type r1 |
29 | __attribute__((unused)); | |
4acedca1 CF |
30 | } |
31 | ||
32 | void | |
33 | test02() | |
34 | { | |
879e1011 PC |
35 | std::ratio_multiply<std::ratio<-INTMAX_MAX, 2>, std::ratio<3, 2>>::type r1 |
36 | __attribute__((unused)); | |
37 | std::ratio_multiply<std::ratio<INTMAX_MAX>, std::ratio<INTMAX_MAX>>::type r2 | |
38 | __attribute__((unused)); | |
4acedca1 CF |
39 | } |
40 | ||
52066eae | 41 | // { dg-error "required from here" "" { target *-*-* } 28 } |
e3223453 | 42 | // { dg-error "expected initializer" "" { target *-*-* } 28 } |
52066eae JW |
43 | // { dg-error "expected initializer" "" { target *-*-* } 35 } |
44 | // { dg-error "expected initializer" "" { target *-*-* } 37 } | |
c34d3fd3 JW |
45 | // { dg-error "overflow in addition" "" { target *-*-* } 0 } |
46 | // { dg-error "overflow in multiplication" "" { target *-*-* } 98 } | |
47 | // { dg-error "overflow in multiplication" "" { target *-*-* } 100 } | |
48 | // { dg-error "overflow in multiplication" "" { target *-*-* } 102 } | |
49 | // { dg-error "overflow in constant expression" "" { target *-*-* } 0 } | |
e3223453 | 50 | // { dg-error "narrowing conversion" "" { target *-*-* } 0 } |
377a5364 JM |
51 | // { dg-prune-output "out of range" } |
52 | // { dg-prune-output "not usable in a constant expression" } |