1 // Copyright (C) 2009-2024 Free Software Foundation, Inc.
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)
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.
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/>.
19 // { dg-require-effective-target dfp }
21 // ISO/IEC TR 24733 doesn't say explicitly that the conversion from a
22 // decimal floating-point type to a generic float type is prohibited but
23 // it implies that in section 4.3 when it says "In C, objects of decimal
24 // floating-oint type can be converted to generic floating-point type by
25 // means of an explicit cast. In C++ this is not possible." Check that
26 // attempt to do a cast are flagged as errors.
28 #include <decimal/decimal>
30 using namespace std::decimal
;
42 f
= d32
; // { dg-error "error" }
43 f
= d64
; // { dg-error "error" }
44 f
= d128
; // { dg-error "error" }
45 d
= d32
; // { dg-error "error" }
46 d
= d64
; // { dg-error "error" }
47 d
= d128
; // { dg-error "error" }
48 ld
= d32
; // { dg-error "error" }
49 ld
= d64
; // { dg-error "error" }
50 ld
= d128
; // { dg-error "error" }
52 f
= (float)d32
; // { dg-error "error" }
53 f
= (float)d64
; // { dg-error "error" }
54 f
= (float)d128
; // { dg-error "error" }
55 d
= (double)d32
; // { dg-error "error" }
56 d
= (double)d64
; // { dg-error "error" }
57 d
= (double)d128
; // { dg-error "error" }
58 ld
= (long double)d32
; // { dg-error "error" }
59 ld
= (long double)d64
; // { dg-error "error" }
60 ld
= (long double)d128
; // { dg-error "error" }