[PATCH] Fix PR/11067 Strange warning with pure virtual inline function

Wolfgang Bangerth bangerth@ices.utexas.edu
Sun Jun 22 09:25:00 GMT 2003


> When a pure virtual function is also marked as inline, gcc should not warn
> about it not being defined with -Winline. The problem is the function is 
> declared inline but this warning does not make sense for pure virtual 
> functions.

Why? It's admittedly rare, but it's legal to have a definition for a pure 
virtual function, and then it can also be inlined. The warning is just as 
useful (or not useful, IMHO) as for any other function.

W.

---------------
struct X {
    virtual inline void f() = 0;
};

struct Y : X {
    virtual void f () {
	X::f ();
      }
};
--------------
tmp/gg> gcc -c x.cc -Winline
x.cc:2: warning: inline function `virtual void X::f()' used but never defined


-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/



More information about the Gcc-patches mailing list