patch: clarify missing template arguments when parsing base specifier

Richard Smith richard at metafoo.co.uk
Tue Sep 3 12:10:47 PDT 2013


Maybe you could use Sema::DiagnoseUnknownTypeName instead? And teach that
code to not perform typo correction in its call to isTemplateName; we have
the same duplicate-diagnostics bug for a case like:

  template<typename T> struct Foobar;
  Goobar x;

... or, worse:

  template<typename T> void Foobar();
  Goobar x;

On Tue, Sep 3, 2013 at 11:38 AM, Nick Lewycky <nlewycky at google.com> wrote:

> On 27 August 2013 15:57, Nick Lewycky <nlewycky at google.com> wrote:
>
>> On 27 August 2013 00:54, Chandler Carruth <chandlerc at google.com> wrote:
>>
>>>
>>> On Tue, Aug 27, 2013 at 12:49 AM, Nick Lewycky <nlewycky at google.com>wrote:
>>>
>>>> Good catch. Foo could be a template function (or a template variable in
>>>> C++14 I suppose) instead of a template class. That I know how to fix.
>>>>
>>>
>>> Yikes, hadn't even thought of the cases when it was the wrong kind of
>>> template-id....
>>>
>>>
>>>> Unfortunately, the template typo correction is wired into
>>>> LookupTemplateName. Even if I bypass isTemplateName and create a
>>>> LookupResult with diagnostics suppressed, we still get the typo
>>>> corrections. I do not know the design of clang well enough to know how to
>>>> change that.
>>>>
>>>
>>> Yea, not saying you need to fix, saying it's worth a PR or something to
>>> track. Maybe talk to Kaelyn so its on her or Richard's radar to look at it.
>>> I'm imagining things like 'sorte' -> 'sort' instead of 'sort' -> 'sorter'.
>>> Maybe I'm too worried, but I'd like to make sure we don't lose track of
>>> this issue.
>>>
>>
>> Fixed. ClassifyName doesn't do typo correction (unless you ask it to).
>> Testcases added.
>>
>> Please review!
>>
>
> Ping! Same patch reattached.
>
> Nick
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130903/c82f6179/attachment.html>


More information about the cfe-commits mailing list