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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.warn/] [impint2.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// { dg-options "-Wconversion" }
3
 
4
// Copyright (C) 2000 Free Software Foundation, Inc.
5
// Contributed by Nathan Sidwell 6 Mar 2000 
6
 
7
// initialization to 'int' from to 'double' We expect consistent warnings
8
// whenever a float is implicitly truncated to int, make sure references
9
// don't confuse us, as Gerald Pfeifer  found out.
10
 
11
struct X
12
{
13
  X (int const &);
14
  X (int const &, int const &);
15
};
16
 
17
void foo (int const &);
18
void wibble (int const &);
19
void wibble (int const &, int const &);
20
void punk (int const & = 3.5f);        // { dg-warning "" } in passing
21
void rock ();
22
void rock (int const &, int  const & = 3.5f);       // { dg-warning "" } in passing
23
 
24
void fn ()
25
{
26
  X x2(3.5f);       // { dg-warning "" } float to int
27
  X x4(1, 3.5f);    // { dg-warning "" } float to int
28
  X x6(3.5f, 1);    // { dg-warning "" } float to int
29
 
30
  X y2 = 3.5f;      // { dg-warning "" } float to int
31
 
32
  int j2 (3.5f);    // { dg-warning "" } float to int
33
 
34
  int k2 = 3.5f;    // { dg-warning "" } float to int
35
 
36
  j2 = 3.5f;        // { dg-warning "" } float to int
37
 
38
  foo (3.5f);       // { dg-warning "" } float to int
39
 
40
  wibble (3.5f);    // { dg-warning "" } float to int
41
  wibble (1, 3.5f); // { dg-warning "" } float to int
42
  wibble (3.5f, 1); // { dg-warning "" } float to int
43
 
44
  punk ();          // { dg-warning "" } float to int
45
  rock (1);         // { dg-warning "" } float to int
46
}
47
 
48
// and make sure we really know when something's unsigned
49
void foo ()
50
{
51
  X x2(-1);
52
  X x4(1, -1);
53
  X x6(-1, 1);
54
 
55
  X y2 = -1;
56
 
57
  int j2 (-1);
58
 
59
  int k2 = -1;
60
 
61
  j2 = -1;
62
 
63
  foo (-1);
64
 
65
  wibble (-1);
66
  wibble (1, -1);
67
  wibble (-1, 1);
68
 
69
}

powered by: WebSVN 2.1.0

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