Author: rnk Date: Thu Feb 18 19:15:08 2016 New Revision: 261292 URL: http://llvm.org/viewvc/llvm-project?rev=261292&view=rev Log: [Sema] PR25181 Fix crash when method declaration with throw spec fails to parse correctly
Fixes crash referenced in PR25181 where dyn_cast is called on a null instance of LM.Method. Reviewers: majnemer, rnk Patch by Don Hinton Differential Revision: http://reviews.llvm.org/D17072 Added: cfe/trunk/test/SemaCXX/pr25181-crash-on-invalid.cpp Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=261292&r1=261291&r2=261292&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original) +++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Thu Feb 18 19:15:08 2016 @@ -52,7 +52,8 @@ NamedDecl *Parser::ParseCXXInlineMethodD } } - HandleMemberFunctionDeclDelays(D, FnD); + if (FnD) + HandleMemberFunctionDeclDelays(D, FnD); D.complete(FnD); Added: cfe/trunk/test/SemaCXX/pr25181-crash-on-invalid.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pr25181-crash-on-invalid.cpp?rev=261292&view=auto ============================================================================== --- cfe/trunk/test/SemaCXX/pr25181-crash-on-invalid.cpp (added) +++ cfe/trunk/test/SemaCXX/pr25181-crash-on-invalid.cpp Thu Feb 18 19:15:08 2016 @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// Don't crash (PR25181). + +template <typename T> class Foo { // expected-note {{template parameter is declared here}} + template <typename T> // expected-error {{declaration of 'T' shadows template parameter}} + void Foo<T>::method(T *) const throw() {} // expected-error {{nested name specifier 'Foo<T>::' for declaration does not refer into a class, class template or class template partial specialization}} +}; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits