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

[basic.stc.dynamic.deallocation] Use of incorrect grammar #3315

Open
sdkrystian opened this issue Oct 22, 2019 · 6 comments · May be fixed by #4451
Open

[basic.stc.dynamic.deallocation] Use of incorrect grammar #3315

sdkrystian opened this issue Oct 22, 2019 · 6 comments · May be fixed by #4451
Assignees

Comments

@sdkrystian
Copy link
Contributor

[basic.stc.dynamic.deallocation] p3 says:

A deallocation function may be an instance of a function template.

and

A template instance is never a usual deallocation function, regardless of its signature.

"instance of a function template" here presumably should just say "function template" to match deallocation functions. Additionally, "template instance" is not a defined term in the standard, presumably it should be "function template specialization".

@jensmaurer
Copy link
Member

jensmaurer commented Oct 22, 2019

Yes, both occurrences of "instance" should be replaced by "specialization".

@sdkrystian
Copy link
Contributor Author

Hm, that would result in allocation functions being templates, while deallocation functions would be functions. Perhaps it would be better for them to be congruent.

@jensmaurer
Copy link
Member

I don't understand. The actual allocation/deallocation function is always a function (perhaps instantiated from a template).

@sdkrystian
Copy link
Contributor Author

Sure, but the current spec refers to allocation functions as being templates:

An allocation function can be a function template

Which isn't correct either

@jensmaurer
Copy link
Member

There are two levels here: One is restrictions on the declaration of the allocation / deallocation function, which also applies to any function templates called "operator new" / "operator delete".
The other level is restrictions on the behavior, which applies to any specialization actually instantiated. (We can't talk about runtime behavior of templates; templates don't exist at runtime.)

[basic.stc.dynamic] has more problems, though: It specifies the name of global allocation/deallocation functions, but not of class member functions.

In my view, we should apply a larger change here:

  • Move most of the hanging paragraph of [basic.stc.dynamic] Into a new subclause "Implicitly-declared global allocation and deallocation functions" at the end of [basic.stc.dynamic].
  • Change [basic.stc.dynamic.allocation] to say "A function or function template whose name is operator new or operator new[] shall satisfy the following rules (syntax rules as bulleted list). Such a function or a specialization of such a function template is called an allocation function."
  • Similar for [basic.stc.dynamic.deallocation].

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Dec 15, 2019
@jensmaurer
Copy link
Member

Editorial meeting: Agreed with larger change. Just call it "operator new" function. Give it a try.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 10, 2020
@jensmaurer jensmaurer linked a pull request Jan 4, 2021 that will close this issue
@jensmaurer jensmaurer self-assigned this Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants