| Summary: | Bogus errors when using a function as a template parameter | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-indexer | Assignee: | Project Inbox <cdt-indexer-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Same root cause (function call on dependent name) as in bug 337686. *** This bug has been marked as a duplicate of bug 337686 *** |
For the following code: struct A { int x; }; struct B { A f(int); }; template <typename Functor> void g(Functor functor) { B b; int y = b.f(functor()).x; // ERRORS HERE } The parser gives two errors at the indicated line: - Field 'x' could not be resolved - Invalid arguments ' Candidates are: A f These are bogus errors. The code is valid if g is instantiated with a Functor that does indeed return an int. At most, the parser could complain if it detects that g is in fact being instantiated with a Functor that does not return an int, but even in that case the error should be at the instantiation site, not the definition site.