This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
typedef & constructor bug
- To: gcc-bugs at gcc dot gnu dot org
- Subject: typedef & constructor bug
- From: Jos van den Oever <Jos dot vandenOever at fenk dot wag-ur dot nl>
- Date: Wed, 08 Mar 2000 10:35:09 +0100
- Organization: Laboratory for Physical Chemistry and Colloid Science
- Reply-To: Jos dot vandenOever at fenk dot wag-ur dot nl
system used SuSE linux 2.0.37
******** preprocessed soure file *************
# 1 "gccbug.cc"
typedef char * Ptr;
class Text {
public:
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:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
/usr/include
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 >@