typedef & constructor bug

Jos van den Oever Jos.vandenOever@fenk.wag-ur.nl
Wed Mar 8 01:35:00 GMT 2000

system used SuSE linux 2.0.37
******** preprocessed soure file *************
# 1 "gccbug.cc"
typedef char * Ptr;
class Text {
        Text(const Ptr);
void useText(const Text &t);
int main() {
        int i=0;
        useText((i>0) ? "ok" : "not ok");
        useText((i>0) ? "ok" : Text("ok"));
        return 0;
******** command line & output   *************
oever@snow:~/cpp/gccbug > gcc -v --save-temps gccbug.cc
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -
D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinu
x -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix)
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cc1plus gccbug.ii -quiet -dumpbase gccbug.cc -version -o gccbug.s
GNU C++ version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled by GNU C
version 2.95.2 19991024 (release).
gccbug.cc: In function `int main()':
gccbug.cc:11: passing `const char *' as argument 1 of `Text::Text(char *)' discards qualifiers
gccbug.cc:7: in passing argument 1 of `useText(const Text &)'
oever@snow:~/cpp/gccbug >@

More information about the Gcc-bugs mailing list