Article View: gnu.g++.bug
Article #548More unnecessary(?) warnings
From: Michael T Pope
Date: Fri, 27 Oct 1989 04:14
Date: Fri, 27 Oct 1989 04:14
44 lines
1892 bytes
1892 bytes
Here are some more seemingly unnecessary warnings.
-----------------foo.C-------------
class foo {
private:
int dummy;
public:
foo() {}
}; // foo
typedef foo* foo_p;
extern void frob1(const foo_p);
extern void frob2(const foo*);
class bar : public foo {
public:
bar() {}
void borf() const {
frob1(this); // warning
frob1((foo*) this); // no warning
frob1(foo_p(this)); // no warning
frob2(this); // no warning
frob2((foo*) this); // no warning
frob2(foo_p(this)); // no warning
}
}; // bar
const bar b;
const foo_p f1 = &b; // warning
const foo_p f2 = (foo*) &b; // no warning
const foo_p f3 = foo_p(&b); // no warning
----------------------------------------
59 Crackle> g++ -v -c -Wall foo.C
gcc version 1.36.0- (based on GCC 1.36)
/usr/local/gnu/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -Wall foo.C /usr/tmp/cca18327.cpp
GNU CPP version 1.36
/usr/local/gnu/gcc-cc1plus /usr/tmp/cca18327.cpp -quiet -dumpbase foo.C -Wall -version -o /usr/tmp/cca18327.s
GNU C++ version 1.36.0- (based on GCC 1.36) (sparc) compiled by GNU C version 1.36.
default target switches: -mfpu -mepilogue -msun-asm
foo.C: In method void bar::borf ()const :
foo.C:17: warning: argument passing of non-const * pointer from const *
foo.C: At top level:
foo.C:27: warning: initialization of non-const * pointer from const *
...(other sensible warnings about unused variables)...
Technical Details
Message-ID:
<8910261245.14885@munnari.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!augean.ua.OZ.AU!mpopeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!augean.ua.OZ.AU!mpope From: mpope@augean.ua.OZ.AU (Michael T Pope) Newsgroups: gnu.g++.bug Subject: More unnecessary(?) warnings Message-ID: <8910261245.14885@munnari.oz.au> Date: 27 Oct 89 04:14:25 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 44