File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ bool ByteCodeStmtGen<Emitter>::visitFunc(const FunctionDecl *F) {
144
144
145
145
auto emitFieldInitializer = [&](const Record::Field *F, unsigned FieldOffset,
146
146
const Expr *InitExpr) -> bool {
147
+ // We don't know what to do with these, so just return false.
148
+ if (InitExpr->getType ().isNull ())
149
+ return false ;
150
+
147
151
if (std::optional<PrimType> T = this ->classify (InitExpr)) {
148
152
if (!this ->visit (InitExpr))
149
153
return false ;
Original file line number Diff line number Diff line change @@ -1228,3 +1228,14 @@ namespace InheritedConstructor {
1228
1228
constexpr S s (1 );
1229
1229
}
1230
1230
}
1231
+
1232
+ namespace InvalidCtorInitializer {
1233
+ struct X {
1234
+ int Y;
1235
+ constexpr X () // expected-note {{declared here}}
1236
+ : Y(fo_o_()) {} // both-error {{use of undeclared identifier 'fo_o_'}}
1237
+ };
1238
+ // no crash on evaluating the constexpr ctor.
1239
+ constexpr int Z = X().Y; // both-error {{constexpr variable 'Z' must be initialized by a constant expression}} \
1240
+ // expected-note {{undefined constructor 'X'}}
1241
+ }
You can’t perform that action at this time.
0 commit comments