xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-new-overaligned-2.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wover-aligned -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // This test verifies that we don't warn when the global operator new is
5*f4a2713aSLionel Sambuc // overridden. That's why we can't merge this with the other test file.
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc void* operator new(unsigned long);
8*f4a2713aSLionel Sambuc void* operator new[](unsigned long);
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc struct Test {
11*f4a2713aSLionel Sambuc   template <typename T>
12*f4a2713aSLionel Sambuc   struct SeparateCacheLines {
13*f4a2713aSLionel Sambuc     T data;
14*f4a2713aSLionel Sambuc   } __attribute__((aligned(256)));
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc   SeparateCacheLines<int> high_contention_data[10];
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc 
helper()19*f4a2713aSLionel Sambuc void helper() {
20*f4a2713aSLionel Sambuc   Test t;
21*f4a2713aSLionel Sambuc   new Test;
22*f4a2713aSLionel Sambuc   new Test[10];
23*f4a2713aSLionel Sambuc }
24