🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1772

possible spurious warning

#1772
From: "Karl Berry."
Date: Tue, 21 Mar 1989 18:30
38 lines
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
Technical Details
Message-ID: <8903211830.AA10828@mote.umb.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!mote.umb.edu!karl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!mote.umb.edu!karl
From: karl@mote.umb.edu ("Karl Berry.")
Newsgroups: gnu.g++.bug
Subject: possible spurious warning
Message-ID: <8903211830.AA10828@mote.umb.edu>
Date: 21 Mar 89 18:30:26 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 38