From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31025 invoked by alias); 15 Oct 2003 11:49:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31018 invoked by uid 48); 15 Oct 2003 11:49:41 -0000 Date: Wed, 15 Oct 2003 11:49:00 -0000 Message-ID: <20031015114941.31017.qmail@sources.redhat.com> From: "bruno at clisp dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031014193706.12615.bruno@clisp.org> References: <20031014193706.12615.bruno@clisp.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/12615] [3.3 Regression] initializer syntax for POD structs gives parse error X-Bugzilla-Reason: CC X-SW-Source: 2003-10/txt/msg01051.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12615 ------- Additional Comments From bruno at clisp dot org 2003-10-15 11:49 ------- Gabriel dos Reis writes: > | The problem with this is that it is not a syntax which is valid in > | initializers _and_ expressions. I'd need to write > > The C99 standard syntax works in both cases No it doesn't. None of the possible syntaxes work both in initializer position and in expression position, with g++ 3.3.1: ===================================================== struct object { unsigned long one_o; unsigned int allocstamp; }; typedef struct object object; void gc_mark (object obj) { // Old GNU designated initializer syntax, without cast. { // As initializer. object a = { one_o: 0, allocstamp: 0 }; // As expression - syntax error in gcc and g++. object b; b = { one_o: 0, allocstamp: 0 }; } // Old GNU designated initializer syntax, with cast. { // As initializer - syntax error in g++. object a = (object) { one_o: 0, allocstamp: 0 }; // As expression. object b; b = (object) { one_o: 0, allocstamp: 0 }; } // New ISO C 99 designated initializer syntax, without cast. { // As initializer - syntax error in g++. object a = { .one_o = 0, .allocstamp = 0 }; // As expression - syntax error in gcc and g++. object b; b = { .one_o = 0, .allocstamp = 0 }; } // New ISO C 99 designated initializer syntax, with cast. { // As initializer - syntax error in g++. object a = (object) { .one_o = 0, .allocstamp = 0 }; // As expression - syntax error in g++. object b; b = (object) { .one_o = 0, .allocstamp = 0 }; } } ========================================================= Which of the four syntaxes you recommend me to choose?