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

Exception specification of implicitly declared deallocation functions #157

Closed
FrankHB opened this issue Jul 28, 2013 · 1 comment
Closed

Comments

@FrankHB
Copy link
Contributor

FrankHB commented Jul 28, 2013

[basic.stc.dynamic]/4 of N3691 says:
The following allocation and deallocation functions (18.6)
are implicitly declared in global scope in each translation unit of a program.
void* operator new(std::size_t);
void* operator new;
void operator delete(void_);
void operator delete;

There are no explicit exception specifications in the declarations.

However, [support.dynamic]/1 says:
Header synopsis

namespace std {
...
void* operator new(std::size_t size);
void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
void operator delete(void* ptr) noexcept;
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
void* operator new[](std::size_t size);
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
void operator delete[](void* ptr) noexcept;
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
void* operator new (std::size_t size, void* ptr) noexcept;
void* operator new[](std::size_t size, void* ptr) noexcept;
void operator delete (void* ptr, void_) noexcept;
void operator delete[](void_ ptr, void*) noexcept;
}

The exception specifications of operator delete/operator delete[] are different.
This inconsistency is probably not by design, since "(18.6)" in [basic.stc.dynamic]/4 links to [support.dynamic] directly without notes about exception specifications.

@zygoloid
Copy link
Member

This came up in discussion of core issue 1552, and we're planning on fixing it there. I don't think we can regard this as editorial, because it's not trivially obvious which of the two contradictory declarations is correct.

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

No branches or pull requests

2 participants