CWG Issue 1184 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-04-13


1184. Argument conversions to nondeduced parameter types

Section: 13.10.3.2 [temp.deduct.call]Status: C++11Submitter: Daniel KrüglerDate: 2010-08-29

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

It is not clear whether the following example is well-formed or not:

template<class T> struct identity { typedef T type; };

template<class T, class C>
void f(T C::*, typename identity<T>::type*){}

struct X { void f() {}; };

int main() { f(&X::f, 0); }

The null pointer conversion required for the second parameter off is not one of the ones permitted by 13.10.3.2 [temp.deduct.call] paragraph 4, but it's unclear whether that list should apply to parameters with nondeduced types or not. 13.10.2 [temp.arg.explicit] paragraph 6 is explicit that

Implicit conversions (7.3 [conv]) will be performed on a function argument to convert it to the type of the corresponding function parameter if the parameter type contains no_template-parameter_s that participate in template argument deduction.

However, this statement appears in a section dealing with explicitly-specified template arguments, so its applicability to nondeduced contexts in general is not clear.

Implementations disagree on the handling of this example.