assert(DefVD);
if (DefVD->isWeak()) return false;
EvaluatedStmt *Eval = DefVD->ensureEvaluatedStmt();
-
+
Expr *Init = cast<Expr>(Eval->Value);
if (Var->getType()->isDependentType() || Init->isValueDependent()) {
- if (!Init->isValueDependent())
- return !DefVD->checkInitIsICE();
- // FIXME: We might still be able to do some analysis of Init here
- // to conclude that even in a dependent setting, Init can never
- // be a constexpr - but for now admit agnosticity.
+ // FIXME: Teach the constant evaluator to deal with the non-dependent parts
+ // of value-dependent expressions, and use it here to determine whether the
+ // initializer is a potential constant expression.
return false;
- }
+ }
+
return !IsVariableAConstantExpression(Var, Context);
}
int d = []{ return [=]{ return n; }(); }(); // expected-error {{'this' cannot be implicitly captured in this context}}
};
}
+
+namespace PR18473 {
+ template<typename T> void f() {
+ T t(0);
+ (void) [=]{ int n = t; }; // expected-error {{deleted}}
+ }
+
+ template void f<int>();
+ struct NoCopy {
+ NoCopy(int);
+ NoCopy(const NoCopy &) = delete; // expected-note {{deleted}}
+ operator int() const;
+ };
+ template void f<NoCopy>(); // expected-note {{instantiation}}
+}