[cfe-commits] [patch] Fix "note" of a duplicate explicit instantiation definition following a specialization

Hans Wennborg hans at chromium.org
Mon Jan 9 05:16:00 CST 2012


On Mon, Jan 2, 2012 at 5:08 PM, Nico Weber <thakis at chromium.org> wrote:
> On Tue, Dec 27, 2011 at 7:45 AM, Hans Wennborg <hans at chromium.org> wrote:
>> On Sat, Dec 24, 2011 at 12:13 AM, Nico Weber <thakis at chromium.org> wrote:
>>> Hi,
>>>
>>> the attached patch fixes the note printed in the error message in
>>>
>>>  namespace SII_WithDefinedTemplate {
>>>    template <typename STRING_TYPE> class BasicStringPiece {};
>>>    template <> class BasicStringPiece<int> { };
>>>    template class BasicStringPiece<int>;  // expected-note {{previous
>>> explicit instantiation is here}}
>>>    template class BasicStringPiece<int>;  // expected-error
>>> {{duplicate explicit instantiation of 'BasicStringPiece<int>'}}
>>>  }
>>>
>>> Without this, clang says "Note: Previous explicit instantiation is
>>> here" and nothing after that.
>>>
>>> (It's a bit weird that this is an error given that the first explicit
>>> instantiation definition counts as a no-op, but that matches existing
>>> behavior.)
>>
>>
>>> +/// \brief Compute the diagnostic location for an explicit instantiation
>>> +//  declaration or definition.
>>
>> Another slash here?
>>
>>> +static SourceLocation DiagLocForExplicitInstantiation(
>>> +    NamedDecl* Decl, SourceLocation PointOfInstantiation) {
>>
>> The star goes on the parameter name.
>
> Both done.

Looks good to me.

Thanks,
Hans



More information about the cfe-commits mailing list