diff options
author | Erich Keane <erich.keane@intel.com> | 2018-06-13 13:25:11 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-06-13 13:25:11 +0000 |
commit | 1d73d1aaa16f9855bc1687e928d614dbb58742be (patch) | |
tree | 7a14a341f0c32ec76a5bd8d025b87bd385e6afe2 /clang/test/SemaCXX/builtins-overflow.cpp | |
parent | c9f727bb85bbff4bf6f112e9887595e9928f4261 (diff) | |
download | bcm5719-llvm-1d73d1aaa16f9855bc1687e928d614dbb58742be.tar.gz bcm5719-llvm-1d73d1aaa16f9855bc1687e928d614dbb58742be.zip |
Correct behavior of __builtin_*_overflow and constexpr.
Enable these builtins to be called across a lambda
boundary with captureless const/constexpr, as brought up by
Eli here: https://reviews.llvm.org/D48040
Differential Revision: https://reviews.llvm.org/D48053
llvm-svn: 334597
Diffstat (limited to 'clang/test/SemaCXX/builtins-overflow.cpp')
-rw-r--r-- | clang/test/SemaCXX/builtins-overflow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/builtins-overflow.cpp b/clang/test/SemaCXX/builtins-overflow.cpp new file mode 100644 index 00000000000..9054cce2573 --- /dev/null +++ b/clang/test/SemaCXX/builtins-overflow.cpp @@ -0,0 +1,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); }(); +} |