From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3734 invoked by alias); 3 Jan 2012 15:25:58 -0000 Received: (qmail 3723 invoked by uid 22791); 3 Jan 2012 15:25:57 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jan 2012 15:25:35 +0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/51741] complicatet brakets wont compile Date: Tue, 03 Jan 2012 15:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg00267.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51741 --- Comment #4 from Jonathan Wakely 2012-01-03 15:25:32 UTC --- The bug reporting guidelines at http://gcc.gnu.org/bugs/ ask for the following which you have not provided: * the exact version of gcc * the exact command line * the complete preprocessed source, not some code snippets (what is pos?) (In reply to comment #0) > (&((knot*)((((*pos).branches)[i]).where))) > > (compiler sas lvaluve needed for unary & operator) The compiler is correct. The cast to (knot*) creates an rvalue, so you cannot take its address. > ((knot**)(&((((*pos).branches)[i]).where))) Here you take the address of an lvalue, then cast it to (knot**), that's legal. > will. > both seem like legal C to me. No, the first one is not. The bug is in your code, not GCC. > (((knot*)((((*pos).branches)[0]).where)).father)=pos; > > won't compile . > compiler thinks I try to adress .father for something thats not a structure or > a union. even though I castet it to a knot* before trying to adress .father. Maybe you mean ->father not .father. Just because your code doesn't compile, that doesn't mean it's a GCC bug.