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>
5
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
9
10struct X
11{
12  X (int);
13  X (int, int);
14};
15
16void foo (int);
17void wibble (int);
18void wibble (int, int);
19void punk (int = 3.5);
20void rock ();
21void rock (int, int = 3.5);
22
23void fn ()
24{
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
31
32  X y1 = 3.5;       // { dg-warning "" } double to int
33  X y2 = 3.5f;      // { dg-warning "" } float to int
34
35  int j1 (3.5);     // { dg-warning "" } double to int
36  int j2 (3.5f);    // { dg-warning "" } float to int
37
38  int k1 = 3.5;     // { dg-warning "" } double to int
39  int k2 = 3.5f;    // { dg-warning "" } float to int
40
41  j1 = 3.5;         // { dg-warning "" } double to int
42  j2 = 3.5f;        // { dg-warning "" } float to int
43
44  foo (3.5);        // { dg-warning "" } double to int
45  foo (3.5f);       // { dg-warning "" } float to int
46
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
53
54  punk ();          // { dg-warning "" } double to int
55  rock (1);         // { dg-warning "" } double to int
56}
57