xref: /aosp_15_r20/external/clang/test/SemaCXX/new-delete-predefined-decl.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -DTEMPLATE_OVERLOAD -fsyntax-only -verify %s
2*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s
3*67e74705SXin Li // expected-no-diagnostics
4*67e74705SXin Li 
5*67e74705SXin Li #include <stddef.h>
6*67e74705SXin Li 
7*67e74705SXin Li // Note that each test must be run separately so it can be the first operator
8*67e74705SXin Li // new declaration in the file.
9*67e74705SXin Li 
10*67e74705SXin Li #if defined(TEMPLATE_OVERLOAD)
11*67e74705SXin Li // Don't crash on global template operator new overloads.
12*67e74705SXin Li template<typename T> void* operator new(size_t, T);
test_template_overload()13*67e74705SXin Li void test_template_overload() {
14*67e74705SXin Li   (void)new(0) double;
15*67e74705SXin Li }
16*67e74705SXin Li #endif
17*67e74705SXin Li 
test_predefined()18*67e74705SXin Li void test_predefined() {
19*67e74705SXin Li   (void)new double;
20*67e74705SXin Li }
21