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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.warn/] [impint2.C] - Blame information for rev 12

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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