This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Confusing error for incorrect struct initialization
- From: Mason <mpeg dot blue at free dot fr>
- To: lh mouse <lh_mouse at 126 dot com>
- Cc: GCC help <gcc-help at gcc dot gnu dot org>
- Date: Sat, 18 Jun 2016 19:42:15 +0200
- Subject: Re: Confusing error for incorrect struct initialization
- Authentication-results: sourceware.org; auth=none
- References: <5764F614 dot 7060108 at free dot fr> <7cebec62 dot 21aed9 dot 155627c508f dot Coremail dot lh_mouse at 126 dot com> <5765760A dot 1050200 at free dot fr> <e9fd21b dot 21bb5d dot 155646493d6 dot Coremail dot lh_mouse at 126 dot com>
On 18/06/2016 18:42, lh mouse wrote:
> Initializing a `int *` with an `int` has to be permitted.
> It is making it an error that would be a bug.
The code I'm interested in is:
struct xxx { void *p; int a,b,c,d; double x,y; };
struct foo { struct xxx *p; int e,f,g; };
struct xxx s;
struct foo bar = { s }; /*** should be &s ***/
(I don't see any int pointers there.)
Do you see the error on the last line?
What error message would you expect a good compiler to output?
Regards.