This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51741] complicatet brakets wont compile
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jan 2012 15:25:32 +0000
- Subject: [Bug c/51741] complicatet brakets wont compile
- Auto-submitted: auto-generated
- References: <bug-51741-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51741
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 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.