https://github.com/HighCommander4 requested changes to this pull request.
Thanks for improving HeuristicResolver :)
I realized while reviewing this patch that the existing default template
argument heuristic is a bit over-eager. For example:
```c++
struct Default {
void foo();
};
struct Custom {
void foo();
};
template <class T, class A = Default>
struct S {
A bar();
};
template <class T>
void baz() {
S<T, Custom> s;
s.bar().foo(); // incorrectly targets Default::foo rather than Custom::foo
}
```
This patch will make that over-eagerness visible in more contexts, for example:
```c++
struct Default {
void foo();
};
struct Custom {
void foo();
};
template <class T, class A = Default>
struct S {
typedef A type;
};
template <class T>
void baz() {
typename S<T, Custom>::type t;
t.foo(); // previously didn't resolve, now incorrectly resolves to
Default::foo
}
```
Making these examples have the desired behaviour would be a more involved
change, so no need to block on that now, but let's maybe add the above examples
to the test suite with FIXMEs.
https://github.com/llvm/llvm-project/pull/223667
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits