Index: lib/AST/DeclCXX.cpp =================================================================== --- lib/AST/DeclCXX.cpp +++ lib/AST/DeclCXX.cpp @@ -1417,7 +1417,7 @@ Context.getCanonicalType(ClassType)); DeclContext::lookup_result R = lookup(Name); - if (R.empty()) + if (R.empty() || !isa(R.front())) return nullptr; CXXDestructorDecl *Dtor = cast(R.front()); Index: test/SemaCXX/PR33189.cpp =================================================================== --- /dev/null +++ test/SemaCXX/PR33189.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +class U +{ + template + ~U() { } // expected-error{{destructor cannot be declared as a template}} +};