Article View: gnu.gcc.bug
Article #773manual says constructor expressions must yield unions or aggregates
From: Paul Eggert
Date: Tue, 31 Oct 1989 01:04
Date: Tue, 31 Oct 1989 01:04
45 lines
1899 bytes
1899 bytes
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:
Technical Details
Message-ID:
<8910310104.AA18888@rise.twinsun.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!twinsun.com!eggertShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!twinsun.com!eggert From: eggert@twinsun.com (Paul Eggert) Newsgroups: gnu.gcc.bug Subject: manual says constructor expressions must yield unions or aggregates Message-ID: <8910310104.AA18888@rise.twinsun.com> Date: 31 Oct 89 01:04:38 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 45