Commit faf6e6df authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r292561:

------------------------------------------------------------------------
r292561 | rsmith | 2017-01-19 17:19:46 -0800 (Thu, 19 Jan 2017) | 3 lines

PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
don't know we're in a dependent context.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@293297 91177308-0d34-0410-b5e6-96231b3b80d8
parent cadf1a49
......@@ -9025,7 +9025,8 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
// 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
......
......@@ -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>;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment