[Bug c++/59975] New: [C++11] Bogus "=?UTF-8?Q?declared=20using=20local=20type=20=E2=80=98?=...=?UTF-8?Q?=E2=80=99?=, is used but never defined"
ppluzhnikov at google dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 28 23:38:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list