Opened 2 weeks ago

Last modified 5 days ago

#14967 accepted defect

internalAstError with function pointer in if

Reported by: chrchr Owned by: chrchr
Priority: Normal Milestone: 2.22
Component: Other Version:
Keywords: internalAstError c Cc:

Description

libvips-8.18.4/libvips/iofuncs/threadpool.c:

void f(int (*fp)()) {
    if (fp && fp()) {}
}
test.cpp:2:12: error: Syntax Error: AST broken, binary operator is missing operand(s). [internalAstError]
    if (fp && fp()) {}
           ^

Requires --language=c.

Change History (2)

comment:1 by chrchr, 2 weeks ago

Milestone: 2.22
Owner: changed from noone to chrchr
Status: newaccepted

comment:2 by chrchr, 5 days ago

Variation:

//void *p, *q;
void f(int (*cmp)(void*, void*)) {
    if (cmp) {
	    if (p && q && cmp(p, q) >= 0) {}
	}
}
Note: See TracTickets for help on using tickets.