diff options
author | Tim Northover <tnorthover@apple.com> | 2017-08-08 23:18:05 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-08-08 23:18:05 +0000 |
commit | 0241637c0ea3e700942490951bbb2236cc6c2f3b (patch) | |
tree | 1e8dcc5dd5b7422f327c810b4f4bf0b1ae0ff513 /clang/test/SemaCXX/integer-overflow.cpp | |
parent | d1fafc8b0569b1cef000e1063657e2752f41ecb4 (diff) | |
download | bcm5719-llvm-0241637c0ea3e700942490951bbb2236cc6c2f3b.tar.gz bcm5719-llvm-0241637c0ea3e700942490951bbb2236cc6c2f3b.zip |
Sema: disable implicit conversion from _Complex to real types in C++.
Converting a _Complex type to a real one simply discards the imaginary part.
This can easily lead to loss of information so for safety (and GCC
compatibility) this patch disallows that when the conversion would be implicit.
The one exception is bool, which actually compares both real and imaginary
parts and so is safe.
llvm-svn: 310427
Diffstat (limited to 'clang/test/SemaCXX/integer-overflow.cpp')
-rw-r--r-- | clang/test/SemaCXX/integer-overflow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/integer-overflow.cpp b/clang/test/SemaCXX/integer-overflow.cpp index a119f0eabe3..6abc9561449 100644 --- a/clang/test/SemaCXX/integer-overflow.cpp +++ b/clang/test/SemaCXX/integer-overflow.cpp @@ -164,7 +164,7 @@ uint64_t check_integer_overflows(int i) { //expected-note {{declared here}} // expected-warning@+3 {{array index 536870912 is past the end of the array (which contains 10 elements)}} // expected-note@+1 {{array 'a' declared here}} uint64_t a[10]; - a[4608 * 1024 * 1024] = 1i; + a[4608 * 1024 * 1024] = 1; // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}} return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024))); |