From 89f1fc0a356ffe28f13aa203bf5a0410df4c51bc Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Tue, 3 Jun 2014 23:27:51 -0400 Subject: [PATCH] compiler/libec: Added warning on deleting const qualified object --- compiler/bootstrap/libec/bootstrap/pass15.c | 2 ++ compiler/libec/src/pass15.ec | 3 +++ 2 files changed, 5 insertions(+) diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index 578d232..59dfb28 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -15329,6 +15329,8 @@ if(exp->__anon1.op.op == SIZEOF && exp->__anon1.op.exp2->expType) { DeclareType(exp->__anon1.op.exp2->expType, 0x0, 0x0); } +if(exp->__anon1.op.op == DELETE && exp->__anon1.op.exp2 && exp->__anon1.op.exp2->expType && __ecereProp_Type_Get_specConst(exp->__anon1.op.exp2->expType)) +Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "deleting const qualified object\n", (((void *)0)))); yylloc = oldyylloc; FreeType(dummy); if(type2) diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index 771a9d1..6f458e7 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -9152,6 +9152,9 @@ void ProcessExpressionType(Expression exp) DeclareType(exp.op.exp2.expType, false, false); } + if(exp.op.op == DELETE && exp.op.exp2 && exp.op.exp2.expType && exp.op.exp2.expType.specConst) + Compiler_Warning($"deleting const qualified object\n"); + yylloc = oldyylloc; FreeType(dummy); -- 1.8.3.1