History

a void to void cast. Allow tcc to compile the following program /////// void func1() {} void func2() { return func1(); } ////// gcc accepts this program

seyko committed 11 years ago

Commit 6fd4e5b1 parent 09feeca1 file · +14 −2Browse files

Unified · Split

tccgen.c+14−2
@@ -2412,8 +2412,20 @@ static void gen_assign_cast(CType *dt) · 2411 unmodified lines
24122412 st = &vtop->type; /* source type */
24132413 dbt = dt->t & VT_BTYPE;
24142414 sbt = st->t & VT_BTYPE;
2415− if (sbt == VT_VOID || dbt == VT_VOID)
2416− tcc_error("cannot cast from/to void");
2415+ if (sbt == VT_VOID || dbt == VT_VOID) {
2416+ if (sbt == VT_VOID && dbt == VT_VOID)
2417+ ; /*
2418+ It is Ok if both are void
2419+ A test program:
2420+ void func1() {}
2421+ void func2() {
2422+ return func1();
2423+ }
2424+ gcc accepts this program
2425+ */
2426+ else
2427+ tcc_error("cannot cast from/to void");
2428+ }
24172429 if (dt->t & VT_CONSTANT)
24182430 tcc_warning("assignment of read-only location");
24192431 switch(dbt) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t