summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/cond.C
blob: d0616e4be554de093d35b3a0b91e251eabe84898 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// { dg-do assemble  }
// GROUPS passed rtti
// Negative testcase for decls in conditions.

int main()
{
  float i;
  
  if (int i = 1)		// { dg-error "" "" { xfail *-*-* } } , 
    {
      char i;			// { dg-error "" "" { xfail *-*-* } } , 
      char j;
    }
  else
    {
      short i;			// { dg-error "" "" { xfail *-*-* } } , 
      char j;
    }

  while (int i = 0)		// { dg-error "previously" }
    {
      int i;			// { dg-error "redeclaration" }
    }

  for (; int i = 0; )		// { dg-error "previously" }
    {
      int i;			// { dg-error "redeclaration" }
    }

  switch (int i = 0)		// { dg-error "" "" { xfail *-*-* } } 
    {
    default:
      int i;			// { dg-error "" "" { xfail *-*-* } } 
    }

  if (struct A { operator int () { return 1; } } *foo = new A) // { dg-error "defined" } 
    ;

  A bar;			// { dg-error "not declared" "decl" } 
  // { dg-error "expected" "exp" { target *-*-* } 39 }
  
  if (enum A { one, two, three } foo = one) // { dg-error "defined" "def" } 
  // { dg-error "not declared" "expected" { target *-*-* } 42 }
    ;

  struct B { operator int () { return 2; } };

  if (struct B * foo = new B)
    ;

  if (int f () = 1)		// { dg-warning "extern" "extern" } 
  // { dg-error "is initialized like a variable" "var" { target *-*-* } 51 }
    ;
  
  if (int a[2] = {1, 2})	// { dg-error "extended init" } 
    ;

}