[PATCH] D34574: [Sema] Disable c++17 aligned new and delete operators if not implemented in the deployment target's c++ standard library

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 14:08:00 PDT 2017


dexonsmith added a comment.

In https://reviews.llvm.org/D34574#791124, @ahatanak wrote:

> Duncan and I had a discussion on this.
>
> We are thinking about adding a warning that tells users that aligned allocation /deallocation operators are being called but they are not defined in the library.


Likely, something like `-Werror=aligned-allocation-availability` (by default).

> If the users haven't defined their own aligned allocation / deallocation operators, they will get a link error if the deployment target is too old, but the warning will tell them what the root cause of the error is. If they have defined their own operators, they will get a false positive warning, but it's still possible to turn it off by passing -faligned-allocation.

Or by passing `-Wno-aligned-allocation-availability`.

> Annotating the implicit declarations with availability will cause compile time errors, so we can't do so if we just want to issue a warning.
> 
> Richard, what do you think?

I also wonder: should we add a warning for such code in pre-C++17?


https://reviews.llvm.org/D34574





More information about the cfe-commits mailing list