[PATCH] D25866: [Sema] Support implicit scalar to vector conversions

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:06:21 PDT 2017


bruno added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:10024
+  // FIXME: The check for C++ here is for GCC compatibility. GCC rejects the
+  //        usage of logical operators with vectors in C. This check could be
+  //        notionally dropped.
----------------
Please mention in the comment the list of logical ops that this applies to: "!, &&, ||"


================
Comment at: test/Sema/vector-gcc-compat.c:101
+
+  v2i64_r = v2i64_a && 1; // expected-error {{invalid vector operand to binary expression ('v2i64' (vector of 2 'long long' values))}}
+  v2i64_r = v2i64_a || 1; // expected-error {{invalid vector operand to binary expression ('v2i64' (vector of 2 'long long' values))}}
----------------
Is this because of && and others only working in C++? If so, we need a better error message here, along the lines of "logical expression with vector only support in C++". If later on we decide to support it in non-C++, we then get rid of the warning.





https://reviews.llvm.org/D25866





More information about the cfe-commits mailing list