3 // Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 11 Apr 1999 <nathan@acm.org>
5 // Derived from bug report from Gabriel Dos Reis
6 // <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
7 // http://gcc.gnu.org/ml/gcc-bugs/1999-03n/msg00888.html
9 // conditional exprs have some funny rules when one of the types is void.
10 // [expr.cond] 5.16, make sure we do the right things
11 // We implement an extension, allowing one side to be void, check we
19 j = (i ? throw X() : 1); // ok, int
20 j = (i ? 1 : throw X()); // ok, int
22 (i ? throw X() : throw X()); // ok, void
24 (i ? i : j) = 1; // ok, int &
25 (i ? throw X() : j) = 1; // { dg-error "" } non-lvalue
26 (i ? j : throw X()) = 1; // { dg-error "" } non-lvalue
27 (i ? throw X() : throw X()) = 1; // { dg-error "" } void
29 (i ? (void)1 : i++); // { dg-error "" } ANSI forbids
30 (i ? i++ : (void)1); // { dg-error "" } ANSI forbids