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

<generator>: Don't use operator new[] and operator delete[] #4621

Conversation

JMazurkiewicz
Copy link
Contributor

_Promise_allocator<void>'s operator new(size_t) is specified to allocate memory with allocator<_Aligned_block> (see [coro.generator.promise]/17), which internally uses ::operator new, not ::operator new[] (see [allocator.members]/5).

@JMazurkiewicz JMazurkiewicz requested a review from a team as a code owner April 23, 2024 18:05
@StephanTLavavej StephanTLavavej added bug Something isn't working generator C++23 generator labels Apr 23, 2024
@StephanTLavavej

This comment was marked as resolved.

@StephanTLavavej StephanTLavavej changed the title <generator>: Don't use new[] and delete[] operators <generator>: Don't use operator new[] and operator delete[] May 10, 2024
@StephanTLavavej StephanTLavavej merged commit 7ad2c73 into microsoft:feature/generator May 10, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Great catch! 😺 I adjusted the PR title due to a mega-nitpick - operator new[] is the function being avoided here, whereas the new operator is when new T appears in source code. (new T[n] isn't really using a new[] operator, although it can generally be thought of that way.)

@JMazurkiewicz JMazurkiewicz deleted the generator/no-new-array-op branch May 13, 2024 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working generator C++23 generator
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants