xref: /llvm-project/clang/test/Sema/integer-overflow.cpp (revision 9332ddfba69c38f9ceef4175b042fba0bb8e67bb)
1 // RUN: %clang_cc1 %s -Wno-unused-value -verify -fsyntax-only
2 
3 namespace GH58944 {
4 struct A {
5   A(unsigned long) ;
6 };
7 
8 A a(1024 * 1024 * 1024 * 1024 * 1024ull); // expected-warning {{overflow in expression; result is 0 with type 'int'}}
9 
f()10 void f() {
11   new int[1024 * 1024 * 1024 * 1024 * 1024ull]; // expected-warning {{overflow in expression; result is 0 with type 'int'}}
12 
13   int arr[]{1,2,3};
14   arr[1024 * 1024 * 1024 * 1024 * 1024ull]; // expected-warning {{overflow in expression; result is 0 with type 'int'}}
15 
16   (int){1024 * 1024 * 1024 * 1024 * 1024}; // expected-warning {{overflow in expression; result is 0 with type 'int'}}
17 }
18 }
19