2018-10-23 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / expr / cond1.C
blob8fb3c0f4f34b4fcfee3f28d32484878ba10ef7a1
1 // { dg-do run }
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 17 Oct 2002 <nathan@codesourcery.com>
6 // PR 7209. We didn't SAVE_EXPR in the right place
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}}};
12 int f() {return 0;}
14 char * Foo (int d)
16   char *c1;
18   c1=a[d==0 ? 0 : 1][f()];
20   return c1;
23 int main ()
25   if (Foo (0) != (void *)a)
26     return 1;
27   return 0;