C++ PATCH: PR 11493 and PR 11495

Gerald Pfeifer gerald@pfeifer.com
Wed Jul 16 12:55:00 GMT 2003


(First, late me state that I really appreciate the huge number of fixes
and improvements you've recently made!)

Unfortunately, I found the current failure mode for this patch not to be
sufficiently helpful:

  template <class T>
  struct D : T {
    void dosomething();
  };

  template <class T>
  void D<T>::dosomething() {
    f();         // problem
    this->g();   // fix variant 1
    T::h();      // fix variant 2
  }

  x.cc: In member function `void D<T>::dosomething()':
  x.cc:8: error: there are no arguments to `f' that depend on a template
    parameter, so a declaration of `f' must be available
  x.cc:8: error: (if you use `-fpermissive', G++ will accept your code, but
   allowing the use of an undeclared name is deprecated)

Without following gcc-patches and your changes to libstdc++, I certainly
would not have known that I need to add "this->" to qualify such
functions.

Alos, I'm not a language lawyer, but is "this->g()" indeed a declaration??


I'm a bit afraid I may start sounding like Joseph, but for changes like
this, which surely will break tons of C++ programs out there, we really
need to provide more information for our users, for example by providing
a clear explanation as part of the documentation for -fpermissive and as
part of the release notes.

Most importantly, this should include how to rewrite programs affected
by this.

Gerald



More information about the Gcc-patches mailing list