================
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -std=c++26 \
+// RUN: -fno-aligned-allocation -Wno-ext-cxx-type-aware-allocators -verify %s
+
+void first() {
+ new int;
+}
+
+namespace std {
+ using size_t = __SIZE_TYPE__;
+ template <class T> struct type_identity { using type = T; };
+ enum class align_val_t : size_t {};
+}
+
+template <class T> void *operator new(std::type_identity<T>, std::size_t,
std::align_val_t) = delete; // #new_decl
+template <class T> void operator delete(std::type_identity<T>, void *,
std::size_t, std::align_val_t) = delete;
+
+struct Foo {
+ int x;
+};
+
+void second() {
+ (void)new Foo; // #new_expr
+ // expected-error@#new_expr {{call to deleted function 'operator new'}}
+ // expected-note@#new_decl {{candidate function [with T = Foo] has been
explicitly deleted}}
+}
----------------
ojhunt wrote:
Bug found by Claude: the align_val_t cache was gated on size, so if aligned
allocation is not enabled align_val_t is not defined implicitly, so a call to
new that occurs prior to an explicitly defined align_val_t we never construct
the align val t parameter and then incorrect allocation is called.
https://github.com/llvm/llvm-project/pull/211482
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits