c++/8214: [3.2/3.3 regression] character conversion problem
bangerth@dealii.org
bangerth@dealii.org
Fri Nov 22 12:46:00 GMT 2002
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
More information about the Gcc-bugs
mailing list