aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/integer-overflow.cpp
blob: be9397e3d170e9b51ee49b8e7a7bc4f9da163a65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %clang_cc1 %s -Wno-unused-value -verify -fsyntax-only

namespace GH58944 {
struct A {
  A(unsigned long) ;
};

A a(1024 * 1024 * 1024 * 1024 * 1024ull); // expected-warning {{overflow in expression; result is 0 with type 'int'}}

void f() {
  new int[1024 * 1024 * 1024 * 1024 * 1024ull]; // expected-warning {{overflow in expression; result is 0 with type 'int'}}

  int arr[]{1,2,3};
  arr[1024 * 1024 * 1024 * 1024 * 1024ull]; // expected-warning {{overflow in expression; result is 0 with type 'int'}}

  (int){1024 * 1024 * 1024 * 1024 * 1024}; // expected-warning {{overflow in expression; result is 0 with type 'int'}}
}
}