| Summary: | Error involving nested templates inside enclosing templates | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-indexer | Assignee: | Nathan Ridge <zeratul976> |
| Status: | VERIFIED FIXED | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, malaperle |
| Version: | Next | ||
| Target Milestone: | 8.2.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=407497 | ||
| Whiteboard: | |||
A similar issue came up in bug 407497, where the nested template's template parameter's *type* (it's a non-type parameter) depends on the enclosing template's template parameter. The fix for both is to specialize the nested template's template parameter with the enclosing template's parameter map, as Markus suggests in his "mstodo" in CPPClassTemplateSpecialization.getTemplateParameters(). As I mentioned in bug 407497, I believe this requires introducing bindings for template parameter specializations. Patch (also fixes bug 407497): https://git.eclipse.org/r/#/c/14533/ Fixed in 8.2.1 and master. Verified in 20130821-2252 (RC1). |
More specifically, this error concerns nested templates inside enclosing templates where the nested template has a template parameter whose default value uses one of the enclosing template's template parameters: struct Cat { int meow(); }; template <typename T> struct enclosing { template <typename U = T> struct nested { typedef U type; }; }; int main() { enclosing<Cat>::nested<>::type t; t.meow(); // ERROR HERE: 'meow' could not be resolved }