http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60277
Bug ID: 60277 Summary: Bogus "inline function virtual ..." used but never defined Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppluzhnikov at google dot com Test case: struct Foo { inline virtual void func() = 0; }; struct Bar : public Foo { void func() { } }; int main() { Foo *f = new Bar; f->func(); } Using trunk: g++ (GCC) 4.9.0 20140219 (experimental) g++ -c -Wall -Wextra t.cc t.cc:2:23: warning: inline function 'virtual void Foo::func()' used but never defined inline virtual void func() = 0; ^ But Foo::func is never actually used. Analysis by Nick Lewycky: The relevant [basic.odr]/2 text is: "A virtual member function is odr-used if it is not pure. A non-overloaded function whose name appears as a potentially-evaluated expression or a member of a set of candidate functions, if selected by overload resolution when referred to from a potentially-evaluated expression, is odr-used, unless it is a pure virtual function and its name is not explicitly qualified." Since the function isn't ODR-used, there's no need for it to have a definition: "An inline function shall be deļ¬ned in every translation unit in which it is odr-used." [basic.odr]/3