http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59975
Bug ID: 59975 Summary: [C++11] Bogus "declared using local type ‘...’, is 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 Google ref: b/12785605 Test: template <typename T> struct AbstractThing { virtual ~AbstractThing() { } virtual const T* method() const = 0; }; template <typename T> struct ConcreteThing : public AbstractThing<T> { virtual ~ConcreteThing() { } virtual const T* method() const { return 0; } }; int main() { struct Foo { }; AbstractThing<Foo>* concrete = new ConcreteThing<Foo>(); int rc = (concrete->method() == 0) ? 0 : 1; delete concrete; return rc; } Using g++ (GCC) 4.9.0 20140128 (experimental) g++ -std=c++11 t.cc t.cc:4:20: error: 'const T* AbstractThing<T>::method() const [with T = main()::Foo]', declared using local type 'const main()::Foo', is used but never defined [-fpermissive] virtual const T* method() const = 0; ^ Adding -fpermissive, the executable links and runs fine, so clearly the never-defined method is not *actually* used.