[gnu.g++.bug] More unnecessary

mpope@augean.ua.OZ.AU (Michael T Pope) (10/27/89)

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)...