P2285R1 — Are default function arguments in the immediate context? (9 items) EWG
Andrzej Krzemieński, Tomasz Kamiński
This paper analyzes whether default function arguments and default member initializers should be considered part of the immediate context of their enclosing construct for SFINAE/concept-checking purposes. Compilers currently diverge significantly on this question, producing inconsistent results when checking type traits or concepts involving types with such defaults. The paper recommends that the Standard mandate these constructs be treated as immediate context, so that substitution failures in default arguments cause a function to be excluded from overload resolution rather than causing a hard error, while also recommending that defaulted default constructors be deleted when their associated default member initializers are ill-formed.

References — Anthropic Citations API

[1]
"Form the users' perspective (both these who call functions/create objects, and who define them)"
[2] chars 17526–18001
"Implementability

From the presented compiler tests, it looks like Clang and ICX (using EDG forntend) have taken the same approach: because both default function arguments and..."

[3]
"This might nave an impact on the ABI."
[4]
"the mechanism end up being, "if the default function argument exists assume it will be valid"."
[5]
"The template instantiation that needs to happen here is either not performed, or its effects still not trigger the hard error."
[8] chars 16376–16685
"Consider:

template <typename T>
struct S
{
  T x;
  T y = T{};

  // explicit S(T x, T y = T{}) : x{x} y{y} {}
};

S x (1);    // ok
S y (1, 2); //..."
      
[8] chars 16376–16685
"Consider:

template <typename T>
struct S
{
  T x;
  T y = T{};

  // explicit S(T x, T y = T{}) : x{x} y{y} {}
};

S x (1);    // ok
S y (1, 2); //..."
      
[9]
"outputs 1 ill-formed"
Summary: P2285R1 asks whether substitution failures in default function arguments should be treated as SFINAE (immediate context) or hard errors, surveys existing compiler divergence on the question, and recommends that such failures be non-erroneous. Nine items were found, including a missing comma in a code example presented as valid, duplicate section numbering, and several spelling and grammar errors.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.