Skip to content

Duplicate explicit template instantiation reports incorrect source location #14230

Open
@llvmbot

Description

@llvmbot
Bugzilla Link 13858
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

Sometimes the note for the "previous explicit instantiation" refers to an implicit instantiation instead of the explicit one. For example, take this as test.cpp:

template <typename T>
struct S {
};

void foo() {
    S<int>();
}

template struct S<int>;
template struct S<int>;

Actual Results:

$ clang -c test.cpp
test.cpp:10:17: error: duplicate explicit instantiation of 'S<int>'
template struct S<int>;
                ^
test.cpp:6:5: note: previous explicit instantiation is here
    S<int>();
    ^
1 error generated.

Expected results:

$ clang -c test.cpp
test.cpp:10:17: error: duplicate explicit instantiation of 'S<int>'
template struct S<int>;
                ^
test.cpp:9:17: note: previous explicit instantiation is here
template struct S<int>;
                ^
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions