Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.warn / impint2.C
blobd5fbc55541fb94719293f685a868624b8d2461e8
1 // { dg-do assemble  }
2 // { dg-options "-Wconversion" }
4 // Copyright (C) 2000 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
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 <pfeifer@dbai.tuwien.ac.at> found out.
11 struct X
13   X (int const &);
14   X (int const &, int const &);
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
24 void fn ()
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
30   X y2 = 3.5f;      // { dg-warning "" } float to int
32   int j2 (3.5f);    // { dg-warning "" } float to int
34   int k2 = 3.5f;    // { dg-warning "" } float to int
36   j2 = 3.5f;        // { dg-warning "" } float to int
38   foo (3.5f);       // { dg-warning "" } float to int
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
44   punk ();          // { dg-warning "" } float to int
45   rock (1);         // { dg-warning "" } float to int
48 // and make sure we really know when something's unsigned
49 void foo ()
51   X x2(-1);
52   X x4(1, -1);
53   X x6(-1, 1);
55   X y2 = -1;
57   int j2 (-1);
59   int k2 = -1;
61   j2 = -1;
63   foo (-1);
65   wibble (-1);
66   wibble (1, -1);
67   wibble (-1, 1);