------------------------------------------------------------------------
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
// 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
}
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>;
+ }
+}