This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


2304. Incomplete type vs overload resolution

Section:  []     Status: NAD     Submitter: John Spicer     Date: 2016-07-05

It is not clear whether the current treatment of an example like the following is what we want:

  template<typename T> void foo(T, int);
  template<typename T> void foo(T&, ...);
  struct Q;
  void fn1(Q &data_vectors) { foo(data_vectors, 0); }

According to [] paragraph 8,

If no conversions are required to match an argument to a parameter type, the implicit conversion sequence is the standard conversion sequence consisting of the identity conversion ( [over.ics.scs]).

This would select the first overload and then fail in attempting to call it because of the incomplete type. On the other hand, it is ill-formed to define or call a function with an incomplete parameter type, although it can be declared, so it might be reasonable to take completeness of the parameter type into consideration for SFINAE purposes. 13.10.3 [temp.deduct] bullet 8.11 says,

[Note: Type deduction may fail for the following reasons:

If a definition of Q were available, we would need to instantiate it to see if it is abstract.

It would seem reasonable for an incomplete type to be invalid as well. That would be consistent with the other rules and general desire not to select functions you can't call based on the template argument types.

Rationale (July, 2017):

CWG determined that no change was needed.