Full name of submitter: Brian Bi
Issue description: CWG2918 contained the following example:
template<bool B> struct X {
void f(short) requires B;
void f(short);
template<typename> void g(short) requires B;
template<typename> void g(short);
};
void test(X<true> x) {
auto r = &X<true>::f; // #5
auto s = &X<true>::g<int>; // #6
}
The intent is that #5 is valid. The wording added to accomplish this intent was, in [over.over]/1:
If the target type contains a placeholder type, placeholder type deduction is performed ([dcl.type.auto.deduct]), and the remainder of this subclause uses the target type so deduced.
This sentence is difficult to understand, since it is not immediately obvious how placeholder type deduction can succeed when the selected member of the overload set is not yet known.
Suggested resolution: Edit Example 3 in [over.over]/6 as follows:
template<bool B> struct X {
+ void e(int) requires B;
+ void e(int);
void f(short) requires B;
void f(long);
template<typename> void g(short) requires B;
template<typename> void g(long);
};
void test() {
+ auto ep = &X<true>::e; // OK, placeholder type deduction succeeds, then most partial-ordering-constrained overload is selected
&X<true>::f; // error: ambiguous; constraints are not considered
&X<true>::g<int>; // error: ambiguous; constraints are not considered
}
Full name of submitter: Brian Bi
Issue description: CWG2918 contained the following example:
The intent is that
#5is valid. The wording added to accomplish this intent was, in [over.over]/1:This sentence is difficult to understand, since it is not immediately obvious how placeholder type deduction can succeed when the selected member of the overload set is not yet known.
Suggested resolution: Edit Example 3 in [over.over]/6 as follows:
template<bool B> struct X { + void e(int) requires B; + void e(int); void f(short) requires B; void f(long); template<typename> void g(short) requires B; template<typename> void g(long); }; void test() { + auto ep = &X<true>::e; // OK, placeholder type deduction succeeds, then most partial-ordering-constrained overload is selected &X<true>::f; // error: ambiguous; constraints are not considered &X<true>::g<int>; // error: ambiguous; constraints are not considered }