| Summary: | [Ambiguity] Function declarator parsed as nested declarator in parameter | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Devin Steffler <devinsteffler.lists> |
| Component: | cdt-parser | Assignee: | Markus Schorn <mschorn.eclipse> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | aniefer |
| Version: | 3.0 | ||
| Target Milestone: | Future | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
There is also a StackOverflowError thrown on openReferences on the declaration of g. John, can you let me know if this is a problem with the AST or not and if it is
covered under 81739. Remember that if something has 0 offset/length then it
will not be displayed in the AST DOM View so it may be misleading. But I
looked at the AST for the code above and it looked like the DOM View was
showing the actual AST (i.e. no pointer op).
Here is another example:
class C { };
void h(int *(C[10])); // void h(int *(*_fp)(C _parm[10]));
// not: void h(int *C[10]);
Chances are its a physical tree problem. Assigning to me for now. This now works properly using the latest out of CVS HEAD. There are still problems w/using Search/Open Declaration on f. Sending bug to Andrew to investigate binding. The AST is still wrong. In
void f( int (C) )
The parameter should look like:
IASTParameterDeclaration
IASTDeclSpecifier : void
IASTFunctionDeclarator
- name = ""
- parameter: type C, name ""
instead we have a parameter named C type int.
in: void h(int *(C[10]));
we expected for the parameter's declaration to look like
IASTParameterDeclaration
IASTDeclSpecifier: int
IASTFunctionDeclarator
- Pointers: *
- name : ""
- parameters: type C[10], name ""
Syntactically, there is no nested declarator for either of these. Semantically,
the parameter behaves the same as if you said: void f( int (*fp)(C c) )
oops, typo, obviously in my first example above, I meant for f's parameter to have declSpec int Future means you commit to fix it in the Future. Inboxes can't make committments. Moving to '--'. *** Bug 90715 has been marked as a duplicate of this bug. *** |
There is a StackOverflowError that is thrown on openDeclarations of g inside foo. It also looks like the AST is incorrect for f's parameter. // example code taken from CPP spec 8.2-7: class C { }; void f(int(C)) { } // void f(int (*fp)(C c)) { } // not: void f(int C); int g(C); void foo() { f(g); // openDeclarations on g causes StackOverflowError }