Index: lib/Parse/ParseCXXInlineMethods.cpp =================================================================== --- lib/Parse/ParseCXXInlineMethods.cpp +++ lib/Parse/ParseCXXInlineMethods.cpp @@ -293,6 +293,8 @@ } void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { + if (!LM.Method) + return; // If this is a member template, introduce the template parameter scope. ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope); TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth); Index: test/SemaCXX/pr25181-crash-on-invalid.cpp =================================================================== --- /dev/null +++ test/SemaCXX/pr25181-crash-on-invalid.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// Don't crash (PR25181). + +template class Foo { // expected-note {{template parameter is declared here}} + template // expected-error {{declaration of 'T' shadows template parameter}} + void Foo::method(T *) const throw() {} // expected-error {{nested name specifier 'Foo::' for declaration does not refer into a class, class template or class template partial specialization}} +};