| Summary: | 'auto' type deduction failure involving templates | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-parser | Assignee: | Markus Schorn <mschorn.eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug |
| Version: | 8.1.0 | ||
| Target Milestone: | 8.1.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
As always, nice example! Added testcase and fix. *** cdt git genie on behalf of Markus Schorn ***
Bug 368311: Specialization of nested class used as argument for class instance.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9e5ceb1a49c557b9175cefac25bd61ba7b7c1bb6
|
In the following code: template <class Value> struct iterator { Value operator*(); }; template <typename Iterator> struct range { Iterator begin(); }; template <typename T> struct A { struct iterator_t : public iterator<T> {}; typedef range<iterator_t> range_t; }; struct S { int x; }; int main() { A<S>::range_t r; auto cur = r.begin(); auto e = *cur; e.x; // ERROR HERE: "Field 'x' could not be resolved" } Something goes wrong in the two 'auto' type deductions in main(), and as a result CDT doesn't seem to know that the type of 'e' is 'S'. Interestingly, if I change the first line in main() to: range<A<S>::iterator_t> r; (which is the same type, just referred to in a different way), it works!