OSDN Git Service

Call abort for runtime test, always return 0 from main.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wcxx-compat-3.c
1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
3 enum E1 { A, B, C };
4 enum E2 { D, E, F };
5 extern void f2 (enum E1);
6
7 void
8 f1 ()
9 {
10   int a = A;
11   enum E1 e1;
12   enum E2 e2;
13
14   f2 (0);       /* { dg-warning "invalid in C\[+\]\[+\]" } */
15   f2 (A);
16   f2 (D);       /* { dg-warning "invalid in C\[+\]\[+\]" } */
17   f2 (a);       /* { dg-warning "invalid in C\[+\]\[+\]" } */
18   f2 (e1);
19   f2 (e2);      /* { dg-warning "invalid in C\[+\]\[+\]" } */
20   f2 ((A));
21   f2 (a ? A : B);
22   f2 ((enum E1) 0);
23   f2 ((enum E1) D);
24   f2 ((enum E1) a);
25   f2 ((enum E1) e2);
26 }
27
28 struct s1 { enum E1 e1 : 3; };
29 struct s2 { enum E2 e2 : 3; };
30
31 void
32 f3 (struct s1 sv1, struct s2 sv2)
33 {
34   f2 (sv1.e1);
35   f2 (sv2.e2);  /* { dg-warning "invalid in C\[+\]\[+\]" } */
36 }
37
38 void
39 f4 (struct s1 *pv1, struct s2 *pv2)
40 {
41   f2 (pv1->e1);
42   f2 (pv2->e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */
43 }
44
45 /* Match all extra informative notes.  */
46 /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */