File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -212,6 +212,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
212
212
if (!this ->visit (SubExpr))
213
213
return false ;
214
214
215
+ // If SubExpr doesn't result in a pointer, make it one.
216
+ if (PrimType FromT = classifyPrim (SubExpr->getType ()); FromT != PT_Ptr) {
217
+ assert (isPtrType (FromT));
218
+ if (!this ->emitDecayPtr (FromT, PT_Ptr, CE))
219
+ return false ;
220
+ }
221
+
215
222
PrimType T = classifyPrim (CE->getType ());
216
223
if (T == PT_IntAP)
217
224
return this ->emitCastPointerIntegralAP (Ctx.getBitWidth (CE->getType ()),
Original file line number Diff line number Diff line change @@ -263,3 +263,10 @@ const int *p = &b;
263
263
const __int128 K = (__int128 )(int * )0 ;
264
264
const unsigned __int128 KU = (unsigned __int128 )(int * )0 ;
265
265
#endif
266
+
267
+
268
+ int test3 (void ) {
269
+ int a [2 ];
270
+ a [0 ] = test3 ; // all-error {{incompatible pointer to integer conversion assigning to 'int' from 'int (void)'}}
271
+ return 0 ;
272
+ }
You can’t perform that action at this time.
0 commit comments