Matheus Izvekov 299be6123b
[clang] Fix CodeComplete crash involving CWG1432 (#129436)
This skips the provisional resolution of CWG1432 just when ordering the
candidates for function call code completion, as otherwise this breaks
some assumptions the implementation makes about how closely related the
candidates are.

As a drive-by, deduplicate the implementation with the one used for
class template partial ordering, and strenghten an assertion which was
previosuly dependent on the order of candidates.

Also add a test for the fix for CWG1432 when partial ordering function
templates, which was otherwise untested.

Fixes #125500
2025-03-03 11:41:50 -03:00

39 lines
1.1 KiB
C++

// Note: the run lines follow their respective tests, since line/column
// matter in this test.
template <int...> struct B {};
template <int> class C;
namespace method {
struct S {
template <int Z>
void waldo(C<Z>);
template <int... Is, int Z>
void waldo(B<Is...>, C<Z>);
};
void foo() {
S().waldo(/*invoke completion here*/);
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):15 %s -o - | FileCheck -check-prefix=CHECK-METHOD %s
// CHECK-METHOD-LABEL: OPENING_PAREN_LOC:
// CHECK-METHOD-NEXT: OVERLOAD: [#void#]waldo(<#C<Z>#>)
// CHECK-METHOD-NEXT: OVERLOAD: [#void#]waldo(<#B<>#>, C<Z>)
}
} // namespace method
namespace function {
template <int Z>
void waldo(C<Z>);
template <int... Is, int Z>
void waldo(B<Is...>, C<Z>);
void foo() {
waldo(/*invoke completion here*/);
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - | FileCheck -check-prefix=CHECK-FUNC %s
// CHECK-FUNC-LABEL: OPENING_PAREN_LOC:
// CHECK-FUNC-NEXT: OVERLOAD: [#void#]waldo(<#B<>#>, C<Z>)
// CHECK-FUNC-NEXT: OVERLOAD: [#void#]waldo(<#C<Z>#>)
}
} // namespace function