mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-22 07:30: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;
|
||||
et := expressionType^.baseType;
|
||||
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}
|
||||
else if (tp^.kind = enumType) and (expressionType^.kind = scalarType) then begin
|
||||
rt := cgWord;
|
||||
et := Unary(expressionType^.baseType);
|
||||
if rt <> et then
|
||||
Gen2(pc_cnv, ord(et), ord(rt));
|
||||
if expressionType^.baseType <> cgVoid then begin
|
||||
rt := cgWord;
|
||||
et := Unary(expressionType^.baseType);
|
||||
if rt <> et then
|
||||
Gen2(pc_cnv, ord(et), ord(rt));
|
||||
end {if}
|
||||
else
|
||||
Error(40);
|
||||
end {if}
|
||||
else if (tp^.kind = scalarType) and (expressionType^.kind = enumType) then begin
|
||||
rt := Unary(tp^.baseType);
|
||||
|
Loading…
Reference in New Issue
Block a user