Given the following snip: template<class T> struct A { template<class U> bool operator==(const A<U>&) = delete; operator bool () { return true; } };
int main() { A<int> a1; A<void> a2; if(a1 == a2) {} } Compilation with g++44 -std=gnu++0x gives: error: deleted function bool A<T>::operator==(const A<U>&) [with U = void, T = int] which is correct but it also issues: At global scope: warning: inline function bool A<T>::operator==(const A<U>&) [with U = void, T = int] used but never defined A similar test case without templates works as expected: struct B {}; struct C { bool operator==(const B&) = delete; operator bool () { return true; } }; int main() { B b; C c; if(c == a) {} } That is, it gives only the error for the deleted function (and where its used). -- Summary: explicitly deleted inline function gives warning "used but never defined" Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: chris dot fairles at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37006