summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/builtins-overflow.cpp
blob: 9054cce2573208559dae5f65adba9ab220e2f6b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
// expected-no-diagnostics

int a() {
  const int x = 3;
  static int z;
  constexpr int *y = &z;
  return []() { return __builtin_sub_overflow((int)x, (int)x, (int *)y); }();
}
int a2() {
  const int x = 3;
  static int z;
  constexpr int *y = &z;
  return []() { return __builtin_sub_overflow(x, x, y); }();
}
OpenPOWER on IntegriCloud