Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.warn / impint.C
blob1c7f0eb66b17c2bd6af3f97ca3affac0d3f3733a
1 // { dg-do assemble  }
2 // { dg-options "-Wconversion" }
3 // Copyright (C) 2000 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com>
6 // derived from a bug report by Johan Kuipers <j.kuipers@chello.nl>
7 // initialization to 'int' from to 'double' We expect consistent warnings
8 // whenever a float is implicitly truncated to int
10 struct X
12   X (int);
13   X (int, int);
16 void foo (int);
17 void wibble (int);
18 void wibble (int, int);
19 void punk (int = 3.5);
20 void rock ();
21 void rock (int, int = 3.5);
23 void fn ()
25   X x1(3.5);        // { dg-warning "" } double to int
26   X x2(3.5f);       // { dg-warning "" } float to int
27   X x3(1, 3.5);     // { dg-warning "" } double to int
28   X x4(1, 3.5f);    // { dg-warning "" } float to int
29   X x5(3.5, 1);     // { dg-warning "" } double to int
30   X x6(3.5f, 1);    // { dg-warning "" } float to int
32   X y1 = 3.5;       // { dg-warning "" } double to int
33   X y2 = 3.5f;      // { dg-warning "" } float to int
35   int j1 (3.5);     // { dg-warning "" } double to int
36   int j2 (3.5f);    // { dg-warning "" } float to int
38   int k1 = 3.5;     // { dg-warning "" } double to int
39   int k2 = 3.5f;    // { dg-warning "" } float to int
41   j1 = 3.5;         // { dg-warning "" } double to int
42   j2 = 3.5f;        // { dg-warning "" } float to int
44   foo (3.5);        // { dg-warning "" } double to int
45   foo (3.5f);       // { dg-warning "" } float to int
47   wibble (3.5);     // { dg-warning "" } double to int
48   wibble (3.5f);    // { dg-warning "" } float to int
49   wibble (1, 3.5);  // { dg-warning "" } double to int
50   wibble (1, 3.5f); // { dg-warning "" } float to int
51   wibble (3.5, 1);  // { dg-warning "" } double to int
52   wibble (3.5f, 1); // { dg-warning "" } float to int
54   punk ();          // { dg-warning "" } double to int
55   rock (1);         // { dg-warning "" } double to int