Skip to content

Commit 0fada09

Browse files
committed
[FOLD] improve ambiguity diagnostic
1 parent d1889b8 commit 0fada09

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5438,7 +5438,7 @@ def err_function_template_partial_spec : Error<
54385438
"function template partial specialization is not allowed">;
54395439

54405440
def err_function_member_spec_ambiguous : Error<
5441-
"ambiguous member function specialization of %0">;
5441+
"ambiguous member function specialization %q0 of %q1">;
54425442
def note_function_member_spec_matched : Note<
54435443
"member function specialization matches %0">;
54445444

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10380,7 +10380,8 @@ Sema::CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous) {
1038010380
}
1038110381
if (Ambiguous) {
1038210382
Diag(Member->getLocation(), diag::err_function_member_spec_ambiguous)
10383-
<< Member;
10383+
<< Member
10384+
<< (InstantiatedFrom ? InstantiatedFrom : Instantiation);
1038410385
for (FunctionDecl *Candidate : Candidates)
1038510386
Diag(Candidate->getLocation(), diag::note_function_member_spec_matched)
1038610387
<< Candidate;

clang/test/CXX/temp/temp.spec/temp.expl.spec/p14-23.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ template<>
4141
constexpr int A<8>::g() { return 3; }
4242

4343
template<>
44-
constexpr int A<6>::g() { return 4; } // expected-error {{ambiguous member function specialization of 'g'}}
44+
constexpr int A<6>::g() { return 4; } // expected-error {{ambiguous member function specialization 'A<6>::g' of 'A::g'}}
4545

4646
static_assert(A<9>::g() == 0);
4747
static_assert(A<1>::g() == 1);

0 commit comments

Comments
 (0)