OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [decimal/] [cast_neg.cc] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2009 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 }
19
// { dg-require-effective-target dfp }
20
 
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.
27
 
28
#include <decimal/decimal>
29
#include <testsuite_hooks.h>
30
 
31
using namespace std::decimal;
32
 
33
float f;
34
double d;
35
long double ld;
36
decimal32 d32;
37
decimal64 d64;
38
decimal128 d128;
39
 
40
void
41
foo (void)
42
{
43
  f = d32;                      // { dg-error "error" }
44
  f = d64;                      // { dg-error "error" }
45
  f = d128;                     // { dg-error "error" }
46
  d = d32;                      // { dg-error "error" }
47
  d = d64;                      // { dg-error "error" }
48
  d = d128;                     // { dg-error "error" }
49
  ld = d32;                     // { dg-error "error" }
50
  ld = d64;                     // { dg-error "error" }
51
  ld = d128;                    // { dg-error "error" }
52
 
53
  f = (float)d32;               // { dg-error "error" }
54
  f = (float)d64;               // { dg-error "error" }
55
  f = (float)d128;              // { dg-error "error" }
56
  d = (double)d32;              // { dg-error "error" }
57
  d = (double)d64;              // { dg-error "error" }
58
  d = (double)d128;             // { dg-error "error" }
59
  ld = (long double)d32;        // { dg-error "error" }
60
  ld = (long double)d64;        // { dg-error "error" }
61
  ld = (long double)d128;       // { dg-error "error" }
62
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.