eggert@twinsun.com (Paul Eggert) (10/31/89)
The GCC manual says that constructor expressions must yield a value of structure, union, or array type. But this doesn't make sense: V = (T){X}; should be equivalent to { T temp = {X}; V = temp; } regardless of whether T is a structure, union, or array type. Furthermore, it doesn't agree with GCC 1.36 (Sun-3, SunOS4.0.3c, with fix from rms@ai.mit.edu 1989/10/19 19:15:07 EDT that permits union initializers with elided braces), which lets constructor expressions yield values of other types. For example, the program main() { return (int){0}; } compiles to the same code as main() { return 0; } Here is a fix. *** old/gcc.texinfo Mon Oct 30 16:59:22 1989 --- new/gcc.texinfo Mon Oct 30 16:49:04 1989 *************** *** 2668,2675 **** GNU C supports constructor expressions. A constructor looks like a cast containing an initializer. Its value is an object of the type specified in ! the cast, containing the elements specified in the initializer. The type ! must be a structure, union or array type. Assume that @code{struct foo} and @code{structure} are declared as shown: --- 2668,2674 ---- GNU C supports constructor expressions. A constructor looks like a cast containing an initializer. Its value is an object of the type specified in ! the cast, containing the elements specified in the initializer. Assume that @code{struct foo} and @code{structure} are declared as shown: