@@ -4706,6 +4706,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4706
4706
case UO_PostInc: { // x++
4707
4707
if (!Ctx.getLangOpts ().CPlusPlus14 )
4708
4708
return this ->emitInvalid (E);
4709
+ if (!T)
4710
+ return this ->emitError (E);
4709
4711
4710
4712
if (!this ->visit (SubExpr))
4711
4713
return false ;
@@ -4727,6 +4729,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4727
4729
case UO_PostDec: { // x--
4728
4730
if (!Ctx.getLangOpts ().CPlusPlus14 )
4729
4731
return this ->emitInvalid (E);
4732
+ if (!T)
4733
+ return this ->emitError (E);
4730
4734
4731
4735
if (!this ->visit (SubExpr))
4732
4736
return false ;
@@ -4748,6 +4752,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4748
4752
case UO_PreInc: { // ++x
4749
4753
if (!Ctx.getLangOpts ().CPlusPlus14 )
4750
4754
return this ->emitInvalid (E);
4755
+ if (!T)
4756
+ return this ->emitError (E);
4751
4757
4752
4758
if (!this ->visit (SubExpr))
4753
4759
return false ;
@@ -4795,6 +4801,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4795
4801
case UO_PreDec: { // --x
4796
4802
if (!Ctx.getLangOpts ().CPlusPlus14 )
4797
4803
return this ->emitInvalid (E);
4804
+ if (!T)
4805
+ return this ->emitError (E);
4798
4806
4799
4807
if (!this ->visit (SubExpr))
4800
4808
return false ;
@@ -4840,6 +4848,9 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4840
4848
return E->isGLValue () || this ->emitLoadPop (*T, E);
4841
4849
}
4842
4850
case UO_LNot: // !x
4851
+ if (!T)
4852
+ return this ->emitError (E);
4853
+
4843
4854
if (DiscardResult)
4844
4855
return this ->discard (SubExpr);
4845
4856
@@ -4853,10 +4864,16 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4853
4864
return this ->emitCast (PT_Bool, ET, E);
4854
4865
return true ;
4855
4866
case UO_Minus: // -x
4867
+ if (!T)
4868
+ return this ->emitError (E);
4869
+
4856
4870
if (!this ->visit (SubExpr))
4857
4871
return false ;
4858
4872
return DiscardResult ? this ->emitPop (*T, E) : this ->emitNeg (*T, E);
4859
4873
case UO_Plus: // +x
4874
+ if (!T)
4875
+ return this ->emitError (E);
4876
+
4860
4877
if (!this ->visit (SubExpr)) // noop
4861
4878
return false ;
4862
4879
return DiscardResult ? this ->emitPop (*T, E) : true ;
@@ -4873,6 +4890,9 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
4873
4890
return this ->discard (SubExpr);
4874
4891
return this ->visit (SubExpr);
4875
4892
case UO_Not: // ~x
4893
+ if (!T)
4894
+ return this ->emitError (E);
4895
+
4876
4896
if (!this ->visit (SubExpr))
4877
4897
return false ;
4878
4898
return DiscardResult ? this ->emitPop (*T, E) : this ->emitComp (*T, E);
0 commit comments