[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03
authorEric Fiselier <eric@efcs.ca>
Thu, 25 Oct 2018 18:16:16 +0000 (18:16 +0000)
committerEric Fiselier <eric@efcs.ca>
Thu, 25 Oct 2018 18:16:16 +0000 (18:16 +0000)
commit84eaf0c9e42ad8480a52cfc3d3cd28d432495fec
tree45d366570bd5ae9ebc604d1a00a734c7833eadb5
parent384a74b0e63d847650e10ac7886fdadd44fc431c
[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03

Summary:
When -faligned-allocation is specified in C++03 libc++ defines std::align_val_t as an unscoped enumeration type (because Clang didn't provide scoped enumerations as an extension until 8.0).
Unfortunately Clang confuses the `align_val_t` overloads of delete with the sized deallocation overloads which aren't enabled. This caused Clang to call the aligned deallocation function as if it were the sized deallocation overload.

For example: https://godbolt.org/z/xXJELh

This patch fixes the confusion.

Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D53508

llvm-svn: 345296
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/cxx03-aligned-allocation-unscoped-enum.cpp [new file with mode: 0644]