Looks good for branch.
On Thu, Aug 21, 2014 at 6:59 PM, Richard Trieu <[email protected]> wrote: > Candidate for 3.5, one-line change to fix a crash on invalid. 3.4 did not > crash on this code. > > > On Thu, Aug 21, 2014 at 6:16 PM, Richard Trieu <[email protected]> wrote: > >> Author: rtrieu >> Date: Thu Aug 21 20:16:44 2014 >> New Revision: 216254 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=216254&view=rev >> Log: >> Fix PR20705, crash on invalid. >> >> dyn_cast -> dyn_cast_or_null to handle a null pointer. >> >> Added: >> cfe/trunk/test/SemaCXX/PR20705.cpp >> Modified: >> cfe/trunk/lib/Sema/SemaDecl.cpp >> >> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=216254&r1=216253&r2=216254&view=diff >> >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 21 20:16:44 2014 >> @@ -9300,7 +9300,7 @@ Sema::FinalizeDeclaration(Decl *ThisDecl >> // Static locals inherit dll attributes from their function. >> if (VD->isStaticLocal()) { >> if (FunctionDecl *FD = >> - dyn_cast<FunctionDecl>(VD->getParentFunctionOrMethod())) { >> + >> dyn_cast_or_null<FunctionDecl>(VD->getParentFunctionOrMethod())) { >> if (Attr *A = getDLLAttr(FD)) { >> auto *NewAttr = cast<InheritableAttr>(A->clone(getASTContext())); >> NewAttr->setInherited(true); >> >> Added: cfe/trunk/test/SemaCXX/PR20705.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/PR20705.cpp?rev=216254&view=auto >> >> ============================================================================== >> --- cfe/trunk/test/SemaCXX/PR20705.cpp (added) >> +++ cfe/trunk/test/SemaCXX/PR20705.cpp Thu Aug 21 20:16:44 2014 >> @@ -0,0 +1,21 @@ >> +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s >> + >> +template <typename T> >> +struct X {}; >> +auto b = []() { >> + struct S { >> + static typename X<decltype(int)>::type Run(){}; >> + // expected-error@-1 4{{}} >> + }; >> + return 5; >> +}(); >> + >> +template <typename T1, typename T2> >> +class PC { >> +}; >> + >> +template <typename T> >> +class P { >> + static typename PC<T, Invalid>::Type Foo(); >> + // expected-error@-1 4{{}} >> +}; >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
