xref: /llvm-project/clang/test/SemaCXX/builtins-overflow.cpp (revision 1d73d1aaa16f9855bc1687e928d614dbb58742be)
1 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
2 // expected-no-diagnostics
3 
4 int a() {
5   const int x = 3;
6   static int z;
7   constexpr int *y = &z;
8   return []() { return __builtin_sub_overflow((int)x, (int)x, (int *)y); }();
9 }
10 int a2() {
11   const int x = 3;
12   static int z;
13   constexpr int *y = &z;
14   return []() { return __builtin_sub_overflow(x, x, y); }();
15 }
16