| Summary: | Member function call of array type variable yields ProblemBinding | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Thomas Corbat <thomas.corbat> | ||||||||
| Component: | cdt-core | Assignee: | Markus Schorn <mschorn.eclipse> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Doug Schaefer <cdtdoug> | ||||||||
| Severity: | minor | ||||||||||
| Priority: | P3 | ||||||||||
| Version: | 8.0 | ||||||||||
| Target Milestone: | 8.1.0 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows 7 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 196652 [details]
A patch fixing my problem specifically, but breaking 30 core tests
A patch fixing my problem specifically, but breaking 30 core tests. Not to be taken as is, but perhaps it provides a hint for the solution.
Created attachment 196659 [details]
Problem fixing patch
This patch fixes the problem without breaking any core tests.
Thanks, I'll have a look tomorrow. Created attachment 196729 [details]
testcase + fix
Thomas, while your patch is correct, I prefer to make a different change. It explicitly performs the transformation of the field-owner to a prvalue, which is what causes the conversion of the array to a pointer.
Markus, that sounds reasonable to me. While I have just tracked the different behavior of pointer and array types and modified the code which causes my problem, your approach is much better. Thanks for the fix! As far as I can see, it works perfectly with my tests. In addition to the fix I have added the method that computes the field owner type to the public API: ICPPASTFieldReference.getFieldOwnerType(). |
Build Identifier: I20110512-2000 When trying to get the binding for the name "foo" in the call "s->foo()" in the example code below, I get a ProblemBinding. ---------------- struct S{ void foo(){} }; int main(){ S s[1]; s->foo(); return 0; } ---------------- I know that the code is silly, but it is nevertheless correct. On the other hand when i change "s" to be a "pointer to S", the binding for foo is correct: ---------------- struct S{ void foo(){} }; int main(){ S *s = new S(); s->foo(); return 0; } ---------------- I've tried to track the difference of the two examples. While I was able to change the behavior in CPPSemantics to correctly resolve the lookup-scope and in Conversions to extract the type, my changes break lots of other core tests (~30). Therefore, my patch is not applicable, but it might give a hint solving the problem. Reproducible: Always