This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8214: [3.2/3.3 regression] character conversion problem
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, yoavhirsch at yahoo dot com
- Date: 22 Nov 2002 19:36:52 -0000
- Subject: Re: c++/8214: [3.2/3.3 regression] character conversion problem
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, yoavhirsch at yahoo dot com, gcc-gnats at gcc dot gnu dot org
Old Synopsis: GCC does not enforce the left-most "const" in a "const char * const" declaration.
New Synopsis: [3.2/3.3 regression] character conversion problem
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Nov 22 11:36:51 2002
State-Changed-Why:
Confirmed. This used to give an error with 2.95, but does
no more. It is thus a regression. The code in question is
-------------------------
void foo(char *dest);
int main() {
const char * const p = "abc";
foo (p);
}
------------------------------
The thing is weird, because if p is not initialized by
"abc" but with a null pointer, then gcc correctly gives
an error...
tmp/g> /home/bangerth/bin/gcc-3.3y-pre/bin/c++ -c x.cc
tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/c++ -c x.cc
tmp/g> c++ -c x.cc
x.cc: In function `int main()':
x.cc:5: passing `const char *const' as argument 1 of `foo(char *)' discards qualifiers
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8214