Thread View: gnu.g++.bug
1 messages
1 total messages
Started by "Karl Berry."
Tue, 21 Mar 1989 18:30
possible spurious warning
Author: "Karl Berry."
Date: Tue, 21 Mar 1989 18:30
Date: Tue, 21 Mar 1989 18:30
38 lines
1771 bytes
1771 bytes
This is with g++1.34.0 on a Sun 3 running 3.4.
It seems that a typedef'ed type is not always the same as the
original type, when combined with `...'. The following program
declares two functions which differ only in whether the argument
is `char*' or `string'. g++ complains about the `string' one
(argument passing of integer from pointer lacks a cast) but not that
char*.
Perhaps this behavior is correct. I was never clear about the status
of typedefs in C++.
Incidentally, perhaps the message ``argument passing of <formal> from
<actual>'' could be changed to ``argument passing of <actual> to <formal>'',
which is a little less convoluted, at least to me.
Karl karl@umb.edu
typedef char* string;
extern void f1(char* ...);
extern void f2(string ...);
main()
{
f1("no warning");
f2("warning");
}
g++ -v -c x.cc
g++ version 1.34.0
/usr/local/gnu/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_FPU__ -Dmc68020 x.cc /tmp/cca10817.cpp
GNU CPP version 1.34
/usr/local/gnu/lib/gcc-c++ /tmp/cca10817.cpp -quiet -dumpbase x.cc -noreg -version -o /tmp/cca10817.s
GNU C++ version 1.34.0 (68k, MIT syntax) compiled by GNU C version 1.34.
In function int main ():
x.cc:9: warning: argument passing of integer from pointer lacks a cast
as -mc68020 /tmp/cca10817.s -o x.o
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads