[Bug c/49748] char * const * cannot be assigned to char const * const *

2015-02-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49748

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #4 from Marek Polacek  ---
(In reply to Tim Ruehsen from comment #3)
> This is much work that could be avoided by an apropriate -W option.

GCC 5 has now the -Wincompatible-pointer-types option that can be used to quiet
the warning.


[Bug c/49748] char * const * cannot be assigned to char const * const *

2012-02-23 Thread tim.ruehsen at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49748

Tim Ruehsen  changed:

   What|Removed |Added

 CC||tim.ruehsen at gmx dot de

--- Comment #3 from Tim Ruehsen  2012-02-23 14:12:00 
UTC ---
Just to clarify it and to add a complete program.

 x.c 
void f(const char *const *args) {}

int main(int argc, char **argv) {
f(argv);
return 0;
}


Compiling with g++ (4.6.2) will do without warning.
Compiling with gcc (4.6.2) gives:

x.c: In function 'main':
x.c:4:2: warning: passing argument 1 of 'f' from incompatible pointer type
[enabled by default]
x.c:1:6: note: expected 'const char * const*' but argument is of type 'char **'


This is somewhat annoying when trying to harden older C sources with
-Wwrite-strings.
One has to insert (very) many casts to avoid the above warning.
This is much work that could be avoided by an apropriate -W option.


[Bug c/49748] char * const * cannot be assigned to char const * const *

2011-07-14 Thread gcc at misc dot lka.org.lu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49748

--- Comment #2 from Alain Knaff  2011-07-14 
17:38:59 UTC ---
Created attachment 24756
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24756
Test program for const warning bug

> the warning is correct, see http://c-faq.com/ansi/constmismatch.html

Thanks for this link. This does indeed confirm what I said, in much less words
than I needed. Moreover, it points out that the issue doesn't exist in C++.

However, it doesn't explain why the issue still present in C.

Any insights into this question?

If this is just to keep some paper-pushers happy, maybe we could keep the
current behavior as the default, but have a -W flag to make gcc mimic g++'s
behavior?


[Bug c/49748] char * const * cannot be assigned to char const * const *

2011-07-14 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49748

--- Comment #1 from Jonathan Wakely  2011-07-14 
16:44:08 UTC ---
the bug reporting guidelines clearly ask for a complete and self-contained test
case, not several snippets of code which don't form a complete program
http://gcc.gnu.org/bugs/

the warning is correct, see http://c-faq.com/ansi/constmismatch.html