mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-31 21:31:54 +00:00
Report an error when trying to cast a void expression to a non-void type.
This commit is contained in:
parent
89f1dbce9b
commit
f7c3c26794
@ -1931,13 +1931,20 @@ if (tp^.kind = scalarType) and (expressionType^.kind = scalarType) then begin
|
|||||||
rt := tp^.baseType;
|
rt := tp^.baseType;
|
||||||
et := expressionType^.baseType;
|
et := expressionType^.baseType;
|
||||||
if rt <> et then
|
if rt <> et then
|
||||||
Gen2(pc_cnv, ord(et), ord(rt));
|
if et <> cgVoid then
|
||||||
|
Gen2(pc_cnv, ord(et), ord(rt))
|
||||||
|
else
|
||||||
|
Error(40);
|
||||||
end {if}
|
end {if}
|
||||||
else if (tp^.kind = enumType) and (expressionType^.kind = scalarType) then begin
|
else if (tp^.kind = enumType) and (expressionType^.kind = scalarType) then begin
|
||||||
rt := cgWord;
|
if expressionType^.baseType <> cgVoid then begin
|
||||||
et := Unary(expressionType^.baseType);
|
rt := cgWord;
|
||||||
if rt <> et then
|
et := Unary(expressionType^.baseType);
|
||||||
Gen2(pc_cnv, ord(et), ord(rt));
|
if rt <> et then
|
||||||
|
Gen2(pc_cnv, ord(et), ord(rt));
|
||||||
|
end {if}
|
||||||
|
else
|
||||||
|
Error(40);
|
||||||
end {if}
|
end {if}
|
||||||
else if (tp^.kind = scalarType) and (expressionType^.kind = enumType) then begin
|
else if (tp^.kind = scalarType) and (expressionType^.kind = enumType) then begin
|
||||||
rt := Unary(tp^.baseType);
|
rt := Unary(tp^.baseType);
|
||||||
|
Loading…
Reference in New Issue
Block a user