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