class OverloadExpr;
class DependentScopeDeclRefExpr;
class CXXConstructExpr;
+class CXXDefaultInitExpr;
class LambdaExpr;
class CXXUnresolvedConstructExpr;
class CXXDependentScopeMemberExpr;
bool KnownContainsUnexpandedParameterPack);
ExprDependence computeDependence(DependentScopeDeclRefExpr *E);
ExprDependence computeDependence(CXXConstructExpr *E);
+ExprDependence computeDependence(CXXDefaultInitExpr *E);
ExprDependence computeDependence(LambdaExpr *E,
bool ContainsUnexpandedParameterPack);
ExprDependence computeDependence(CXXUnresolvedConstructExpr *E);
return D;
}
+ExprDependence clang::computeDependence(CXXDefaultInitExpr *E) {
+ return E->getExpr()->getDependence();
+}
+
ExprDependence clang::computeDependence(LambdaExpr *E,
bool ContainsUnexpandedParameterPack) {
auto D = toExprDependence(E->getType()->getDependence());
CXXDefaultInitExprBits.Loc = Loc;
assert(Field->hasInClassInitializer());
- setDependence(ExprDependence::None);
+ setDependence(computeDependence(this));
}
CXXTemporary *CXXTemporary::Create(const ASTContext &C,
constexpr int Z = X().Y; // expected-error {{constexpr variable 'Z' must be initialized by a constant expression}}
struct X2 {
- int Y = foo(); // expected-error {{use of undeclared identifier 'foo'}} \
- // expected-note {{subexpression not valid in a constant expression}}
+ int Y = foo(); // expected-error {{use of undeclared identifier 'foo'}}
constexpr X2() {} // expected-error {{constexpr constructor never produces a constant expression}}
};
// no bogus "delegation cycle" diagnostic
CycleDelegate(float) : CycleDelegate(1) {}
};
+
+struct X4 {
+ int* p = new int(invalid()); // expected-error {{use of undeclared identifier}}
+};
+// no crash on evaluating the CXXDefaultInitExpr.
+constexpr int* s = X4().p; // expected-error {{must be initialized by}}