1 // RUN: %clang_cc1 %s -verify -fno-builtin -std=c++14
3 using size_t = decltype(sizeof(int));
5 #define _diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__)))
7 namespace operator_new
{
10 static void *operator new(size_t i
) _diagnose_if(i
== sizeof(int), "yay", "warning"); // expected-note{{from 'diagnose_if'}}
15 static void *operator new[](size_t i
) _diagnose_if(i
== 8 * sizeof(int), "yay", "warning"); // expected-note 2{{from 'diagnose_if'}}
19 new T0
; // expected-warning{{yay}}
20 new T1
[8]; // expected-warning{{yay}}
21 new T1
[4][2]; // expected-warning{{yay}}
22 new T1
[x
]; // no warning.
24 } // namespace operator_new