OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [cond.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do assemble  }
2
// GROUPS passed rtti
3
// Negative testcase for decls in conditions.
4
 
5
int main()
6
{
7
  float i;
8
 
9
  if (int i = 1)                // { dg-error "previously" }
10
    {
11
      char i;                   // { dg-error "redeclaration" }
12
      char j;
13
    }
14
  else
15
    {
16
      short i;                  // { dg-error "redeclaration" }
17
      char j;
18
    }
19
 
20
  while (int i = 0)             // { dg-error "previously" }
21
    {
22
      int i;                    // { dg-error "redeclaration" }
23
    }
24
 
25
  for (; int i = 0; )           // { dg-error "previously" }
26
    {
27
      int i;                    // { dg-error "redeclaration" }
28
    }
29
 
30
  switch (int i = 0)            // { dg-error "previously" }
31
    {
32
    default:
33
      int i;                    // { dg-error "redeclaration" }
34
    }
35
 
36
  if (struct A { operator int () { return 1; } } *foo = new A) // { dg-error "defined" }
37
    ;
38
 
39
  A bar;                        // { dg-error "not declared" "decl" }
40
  // { dg-error "expected" "exp" { target *-*-* } 39 }
41
 
42
  if (enum A { one, two, three } foo = one) // { dg-error "defined" "def" }
43
  // { dg-error "not declared" "expected" { target *-*-* } 42 }
44
    ;
45
 
46
  struct B { operator int () { return 2; } };
47
 
48
  if (struct B * foo = new B)
49
    ;
50
 
51
  if (int f () = 1)             // { dg-warning "extern" "extern" }
52
  // { dg-error "is initialized like a variable" "var" { target *-*-* } 51 }
53
    ;
54
 
55
  if (int a[2] = {1, 2})        // { dg-error "extended init" "" { target c++98 } }
56
    ;
57
 
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.