This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95 problem
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95 problem
- From: John Temples <john at kuwait dot net>
- Date: Wed, 11 Aug 1999 00:06:24 -0700 (PDT)
- Reply-To: john at whitefang dot com
gcc -v gives:
Reading specs from /usr/local/lib/gcc-lib/i486-pc-sco3.2v5.0/2.95/specs
gcc version 2.95 19990728 (release)
This code, which compiled without error on egcs 1.1, gives the error
"passing `const char *' as argument 1 of `fooclass::foo(char *)'
discards qualifiers" on the second bar.foo call. Compiler invoked with
no options. Adding -fno-const-strings eliminates the error.
class fooclass {
public:
void foo(char *bar) { }
};
main()
{
fooclass bar;
int a = 0;
bar.foo("bar"); /* ok */
bar.foo(a ? "bar" : "baz"); /* compile error */
}
--
John W. Temples, III