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]

gcc 2.95 problem


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


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