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

[temp.deduct.general] Clarify explicit-specifier and exception specifications CWG2618 #5130

Closed
wants to merge 1 commit into from

Conversation

jensmaurer
Copy link
Member

Fixes #5129

@jensmaurer
Copy link
Member Author

@cmeerw, something like this?

@cmeerw
Copy link
Contributor

cmeerw commented Nov 27, 2021

yes, looks good to me.

@xmh0511
Copy link
Contributor

xmh0511 commented Dec 1, 2021

@jensmaurer Should we also improve the second sentence of [temp.deduct.general] p8 to make [temp.deduct.general.note.4] have a formal explanation? The current sentence is that

Only invalid types and expressions in the immediate context of the function type, its template parameter types, and its explicit-specifier can result in a deduction failure.

I think we may change it to

Only invalid types and expressions in the immediate context of the function type outside of the exception specification, its template parameter types, and its explicit-specifier can result in a deduction failure.

In other words, the substitution in exception specification that would result in invalid types and expressions can make the program be ill-formed, which is what the note saying


Incidentally, the deduction failure can also occur in the default argument of a template parameter. For instance

struct A{
    using type = int;
};
template<class T, int U =  T::v>
void fun(T){};

template<class T>
void fun(T*){}
int main(){
  A* ptr = 0;
  fun(ptr);
}

The current wording only mentions the template parameter types.

@jensmaurer
Copy link
Member Author

@xmh0511, since this is not the place where we specify exactly where we substitute, we can be a bit hazy here. We should not be incorrect. I've fixed the obvious problem, and I've moved the "only" to apply to "immediate context", not to "invalid stuff".

its template parameter types,
Invalid types and expressions only in the immediate context of
the function's type outside of the exception specification,
its template parameters,
Copy link
Contributor

@xmh0511 xmh0511 Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jensmaurer Could we change template parameters to template-parameters; It would indicate the deduction failures in default template arguments are also covered by these rules. In the same manner as the latter case(i.e, use its grammar to expound the rule).

@tkoeppe
Copy link
Contributor

tkoeppe commented Aug 19, 2022

@jensmaurer Could this be something you could quickly look at in CWG? No objections otherwise, but if you have a slot for GitHub reviews, it would be nice to get core sign-off.

@tkoeppe tkoeppe added the cwg Issue must be reviewed by CWG. label Aug 19, 2022
@jensmaurer jensmaurer changed the title [temp.deduct.general] Clarify explicit-specifier and exception specifications [temp.deduct.general] Clarify explicit-specifier and exception specifications CWG2618 Aug 27, 2022
@jensmaurer
Copy link
Member Author

jensmaurer commented Aug 27, 2022

Created CWG2618 for CWG review and visibility.

@wg21bot wg21bot added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Jun 28, 2023
@frederick-vs-ja
Copy link
Contributor

Should have been superseded by #5984 (bb4acc8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[temp.deduct.general]/p7 should exclude exception specifications CWG2618
6 participants