r292561 - PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 26 16:45:45 PST 2017
Sure, why not.
On 26 January 2017 at 15:56, Hans Wennborg <hans at chromium.org> wrote:
> A candidate for clang 4?
>
> On Thu, Jan 19, 2017 at 5:19 PM, Richard Smith via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
> > Author: rsmith
> > Date: Thu Jan 19 19:19:46 2017
> > New Revision: 292561
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=292561&view=rev
> > Log:
> > PR31701: Fix crash on invalid caused by parsing a dependent initializer
> when we
> > don't know we're in a dependent context.
> >
> > Modified:
> > cfe/trunk/lib/AST/ASTContext.cpp
> > cfe/trunk/test/SemaCXX/constant-expression.cpp
> >
> > Modified: cfe/trunk/lib/AST/ASTContext.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> ASTContext.cpp?rev=292561&r1=292560&r2=292561&view=diff
> > ============================================================
> ==================
> > --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> > +++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jan 19 19:19:46 2017
> > @@ -9021,7 +9021,8 @@ bool ASTContext::DeclMustBeEmitted(const
> >
> > // Variables that have initialization with side-effects are required.
> > if (VD->getInit() && VD->getInit()->HasSideEffects(*this) &&
> > - !VD->evaluateValue())
> > + // We can get a value-dependent initializer during error recovery.
> > + (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
> > return true;
> >
> > // Likewise, variables with tuple-like bindings are required if their
> >
> > Modified: cfe/trunk/test/SemaCXX/constant-expression.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaCXX/constant-expression.cpp?rev=292561&r1=292560&r2=292561&view=diff
> > ============================================================
> ==================
> > --- cfe/trunk/test/SemaCXX/constant-expression.cpp (original)
> > +++ cfe/trunk/test/SemaCXX/constant-expression.cpp Thu Jan 19 19:19:46
> 2017
> > @@ -143,3 +143,14 @@ namespace rdar16064952 {
> > }
> >
> > char PR17381_ice = 1000000 * 1000000; // expected-warning {{overflow}}
> expected-warning {{changes value}}
> > +
> > +namespace PR31701 {
> > + struct C {
> > + template<int i> static int n; // expected-warning {{extension}}
> > + };
> > + template <int M> class D;
> > + template <int M>
> > + template<int i> void D<M>::set() { // expected-error {{from class
> 'D<M>' without definition}}
> > + const C c = C::n<i>;
> > + }
> > +}
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170126/9cde3a59/attachment.html>
More information about the cfe-commits
mailing list