diff options
| author | Eric Fiselier <eric@efcs.ca> | 2019-02-03 03:44:31 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2019-02-03 03:44:31 +0000 |
| commit | 24a2a48bc2e042ca9684d5dfb71e4a28a12a32b0 (patch) | |
| tree | 1f4713b29b4345ae3241dff62f33dd8a4b2a377a /clang/test/SemaCXX/cxx2a-destroying-delete.cpp | |
| parent | 888aa5dedd84c244c67c167e1ef0613bff879123 (diff) | |
| download | bcm5719-llvm-24a2a48bc2e042ca9684d5dfb71e4a28a12a32b0.tar.gz bcm5719-llvm-24a2a48bc2e042ca9684d5dfb71e4a28a12a32b0.zip | |
Fix handling of usual deallocation functions in various configuratios.
Clang allows users to enable or disable various types of allocation
and deallocation regardless of the C++ dialect. When extended new/delete
overloads are enabled in older dialects, we need to treat them as if
they're usual.
Also, disabling one usual deallocation form shouldn't
disable any others. For example, disabling aligned allocation in C++2a
should have no effect on destroying delete.
llvm-svn: 352980
Diffstat (limited to 'clang/test/SemaCXX/cxx2a-destroying-delete.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx2a-destroying-delete.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/cxx2a-destroying-delete.cpp b/clang/test/SemaCXX/cxx2a-destroying-delete.cpp index 6115774e383..553b7a7080f 100644 --- a/clang/test/SemaCXX/cxx2a-destroying-delete.cpp +++ b/clang/test/SemaCXX/cxx2a-destroying-delete.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=c++2a -verify %s +// RUN: %clang_cc1 -std=c++2a -fexceptions -verify %s +// RUN: %clang_cc1 -std=c++2a -verify %s namespace std { using size_t = decltype(sizeof(0)); @@ -58,11 +59,13 @@ namespace delete_selection { C(); void *operator new(std::size_t); void operator delete(void*) = delete; - void operator delete(C *, std::destroying_delete_t) = delete; + void operator delete(C *, std::destroying_delete_t) = delete; // expected-note 0-1 {{deleted here}} }; - // FIXME: This should be ill-formed, but we incorrectly decide that overload - // resolution failed (because it selected a deleted function) and thus no - // 'operator delete' should be called. + // TODO: We only diagnose the use of a deleted operator delete when exceptions + // are enabled. Otherwise we don't bother doing the lookup. +#ifdef __EXCEPTIONS + // expected-error@+2 {{attempt to use a deleted function}} +#endif C *new_C() { return new C; } struct D { |

