This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/27697] [4.0/4.1/4.2 Regression] incorrect warning about constness of pointer to an array in a const struct



------- Comment #3 from neil at daikokuya dot co dot uk  2006-05-21 23:17 -------
Subject: Re:  [4.0/4.1/4.2 Regression] incorrect warning about constness of
pointer to an array in a const struct

pinskia at gcc dot gnu dot org wrote:-

> 
> 
> ------- Comment #2 from pinskia at gcc dot gnu dot org  2006-05-21 16:15 -------
> This is also rejects valid with -pedantic-errors.
> I don't understand what is correct here so I am not going to confirm it.

If I understand correctly I think the report is correct about
validity for both C90 and C99; another front end gives

"/tmp/bar.c", line 10: error: cannot convert initializer of type "const
        int (*)[10]" to type "int (*)[10]"
  int (*qoox)[10] = bar.x; /* should warn */
                    ^
"/tmp/bar.c", line 11: error: expression must be a modifiable lvalue
  bar.x[0][1] = 23; /* error: asignment to const */
  ^
"/tmp/bar.c", line 9: warning: variable "baz" declared but not used
  const int (*baz)[10] = bar.x; /* should be ok */
              ^

2 errors found compiling "/tmp/bar.c".


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27697


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]