r216254 - Fix PR20705, crash on invalid.
Tom Stellard
tom at stellard.net
Fri Aug 22 14:11:01 PDT 2014
I can merge this patch for 3.5.1. Please remind me after 3.5.0 has been released.
-Tom
On Fri, Aug 22, 2014 at 02:00:20PM -0700, Bill Wendling wrote:
> No. It’s too late for the branch.
>
> -bw
>
> On Aug 21, 2014, at 7:08 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>
> > Looks good for branch.
> >
> >
> > On Thu, Aug 21, 2014 at 6:59 PM, Richard Trieu <rtrieu at google.com> 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 <rtrieu at google.com> 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 at -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 at -1 4{{}}
> > +};
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> >
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list