OSDN Git Service

PR c++/12181
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / expr / cond1.C
1 // { dg-do run }
2
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 17 Oct 2002 <nathan@codesourcery.com>
5
6 // PR 7209. We didn't SAVE_EXPR in the right place
7
8 char a[2][1][16]={
9   {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
10   {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}};
11
12 int f() {return 0;}
13
14 char * Foo (int d)
15 {
16   char *c1;
17
18   c1=a[d==0 ? 0 : 1][f()];
19
20   return c1;
21 }
22
23 int main ()
24 {
25   if (Foo (0) != (void *)a)
26     return 1;
27   return 0;
28 }