Community
Participate
Working Groups
#include <stdio.h> typedef struct { int x; } A; void (*function(A *a))(void) { printf("%d\n", a->x); return NULL; } int main() { A a = { 7 }; function(&a); return 0; } In the C code above, a "Field 'x' could not be resolved" error is shown at a->x.
Works fine for me. Are you using Eclipse Kepler?
Using Eclipse Kepler, Build id 20130614-0229 Apparently it happens only in C projects, not in C++ projects.
Ah yes, I see it now. I was trying it in C++.
Patch: https://git.eclipse.org/r/14763
*** cdt git genie on behalf of Nathan Ridge *** Bug 413204 - "field could not be resolved" error in function returning function pointer Change-Id: I9f2e9b0f46a46232961948fd3d4310e520d95774 Signed-off-by: Nathan Ridge <zeratul976@xxxxxxxxxxx> Reviewed-on: <a href="https://git.eclipse.org/r/14763">https://git.eclipse.org/r/14763</a> Reviewed-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> IP-Clean: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> Tested-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2accba3b07e0a9bf177431521ca4ce442609c6e0
Fixed in 8.2.1 and master.
This still doesn't work in C. It looks like the test I wrote only tests it for C++ (which is strange as it already worked in C++...). Anyways, reopening.
This patch fixes the test and the code: https://git.eclipse.org/r/#/c/15840/
*** cdt git genie on behalf of Nathan Ridge *** Bug 413204 - "field could not be resolved" error in function returning function pointer (really fixed this time) Change-Id: Ica4255ca554db6952248fe1fae53d188a1b78d75 Signed-off-by: Nathan Ridge <zeratul976@xxxxxxxxxxx> Reviewed-on: <a href="https://git.eclipse.org/r/15840">https://git.eclipse.org/r/15840</a> Reviewed-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> IP-Clean: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> Tested-by: Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9745cb982655172e4a354dd967e80dee06ad3bc5
Fixed in cdt_8_2 and master.