summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/dependent-template-recover.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When constructing source-location information for aDouglas Gregor2011-03-041-0/+42
| | | | | | | | | | DependentTemplateSpecializationType during tree transformation, retain the NestedNameSpecifierLoc as it was used to translate the template name, rather than reconstructing it from the template name. Fixes PR9401. llvm-svn: 127015
* Improve recovery when we see a dependent template name that is missingDouglas Gregor2010-05-211-0/+3
| | | | | | | | | | | | | | | the required "template" keyword, using the same heuristics we do for dependent template names in member access expressions, e.g., test/SemaTemplate/dependent-template-recover.cpp:11:8: error: use 'template' keyword to treat 'getAs' as a dependent template name T::getAs<U>(); ^ template Fixes PR5404. llvm-svn: 104409
* Improve parser recovery when we encounter a dependent template nameDouglas Gregor2010-05-211-0/+15
that is missing the 'template' keyword, e.g., t->getAs<T>() where getAs is a member of an unknown specialization. C++ requires that we treat "getAs" as a value, but that would fail to parse since T is the name of a type. We would then fail at the '>', since a type cannot be followed by a '>'. This is a very common error for C++ programmers to make, especially since GCC occasionally allows it when it shouldn't (as does Visual C++). So, when we are in this case, we use tentative parsing to see if the tokens starting at "<" can only be parsed as a template argument list. If so, we produce a diagnostic with a fix-it that states that the 'template' keyword is needed: test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword is required to treat 'getAs' as a dependent template name t->getAs<T>(); ^ template This is just a start of this patch; I'd like to apply the same approach to everywhere that a template-id with dependent template name can be parsed. llvm-svn: 104406
OpenPOWER on IntegriCloud