Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWG2296 Are default argument instantiation failures in the “immediate context”? #1377

Open
jfbastien opened this issue Nov 24, 2022 · 1 comment
Labels
EWG Evolution needs-revision Paper needs changes before it can proceed
Milestone

Comments

@jfbastien
Copy link
Collaborator

jfbastien commented Nov 24, 2022

Migrating from https://isocpp.org/files/papers/P1018R18.html#issues
CWG2296

Section: 13.10.3 [temp.deduct] Status: extension Submitter: Jason Merrill Date: 2016-06-25
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.

Notes from the June, 2016 meeting:

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

Meeting: (notes 2020-05-07)

The first example under issue 3 of paper P0348R0 should become well-formed.

SF F N A SA

0 1 4 3 6

The second example under issue 3 of paper P0348R0 should become well-formed.

SF F N A SA

1 5 7 3 0

This is an issue. We’d like to see a paper addressing it. It should explore what “Immediate context” means. No objection to unanimous consent.

Daveed / Hubert might entertain writing a paper explaining this.

Ville emailed EWG about this.

JF contacted Andrzej to see if he’s interested in addressing this. Not sure he is.

Meeting 2020-10-28: Tomasz will write a paper which exposes the issue and what he thinks should be done (but not resolving wording itself). Hubert remembers an email about this, will find it and sync with JF.

Meeting 2021-01-14: Andrzej wrote a paper for this (emailed 2021-01-12 to EWG).

@jensmaurer
Copy link
Member

The links to the old e-mail thread seem to be wrong, above. Use this one: https://lists.isocpp.org/ext/2020/05/13752.php instead. And Andrzej's announcement of his paper is here: https://lists.isocpp.org/ext/2021/01/15815.php

This issue would be resolved by P2285 Are default function arguments in the immediate context? #976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EWG Evolution needs-revision Paper needs changes before it can proceed
Projects
None yet
Development

No branches or pull requests

2 participants