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

Hans Wennborg hans at chromium.org
Tue Dec 27 07:45:29 PST 2011


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.

Thanks,
Hans




More information about the cfe-commits mailing list