Title
Are default argument instantiation failures in the “immediate context”?
Status
open
Section
13.10.3 [temp.deduct]
Submitter
Jason Merrill

Created on 2016-06-25.00:00:00 last changed 4 months ago

Messages

Date: 2024-06-29.11:27:33

CWG 2024-06-28

See also issues 1554 and 1844 for other cases of missing clarity for "immediate context".

Date: 2016-06-15.00:00:00

Notes from the June, 2016 meeting:

CWG decided to refer this question to EWG for their consideration.

EWG 2022-11-11

This is tracked in github issue cplusplus/papers#1377. See also paper P2285 (Are default function arguments in the immediate context?), tracked by github issue cplusplus/papers#976.

Date: 2016-06-25.00:00:00

Consider the following example (taken from issue 3 of paper P0348R0):

  template <typename U> void fun(U u = U());

  struct X {
    X(int) {}
  };

  template <class T> decltype(fun<T>()) g(int) { }

  template<> void g(long) { }

  int main() { g<X>(0); }

When is the substitution into the return type done? The current specification makes this example ill-formed because the failure to instantiate the default argument in the decltype operand is not in the immediate context of the substitution, although a plausible argument for making this a SFINAE case can be made.

History
Date User Action Args
2024-06-29 11:27:33adminsetmessages: + msg7768
2022-11-25 06:54:20adminsetstatus: extension -> open
2018-02-27 00:00:00adminsetmessages: + msg6035
2016-06-25 00:00:00admincreate