[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03
authorEric Fiselier <eric@efcs.ca>
Wed, 24 Oct 2018 22:38:49 +0000 (22:38 +0000)
committerEric Fiselier <eric@efcs.ca>
Wed, 24 Oct 2018 22:38:49 +0000 (22:38 +0000)
commit5e707cb274911a76e129c1faa71dd95d2b580101
tree404a20e7ef2b7a135994b03c4e261edc35f47ccc
parent43bc46207a909c84651ac77f72fbc478d525594c
[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: 345211
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/cxx03-aligned-allocation-unscoped-enum.cpp [new file with mode: 0644]