[clang] [Clang][Sema] Prevent implicit casting Complex type to Vector (PR #187954)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 08:21:00 PDT 2026
================
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify=c %s
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx %s
+
+typedef char __attribute__((__vector_size__(64))) V;
+
+void implicit_cast_complex_to_vector() {
+ _Complex double x;
+ V y;
+ // c-error at +2 {{implicit conversion from '_Complex double' to incompatible type 'V' (vector of 64 'char' values)}}
+ // cxx-error at +1 {{implicit conversion from '_Complex double' to 'V' (vector of 64 'char' values) is not permitted in C++}}
----------------
erichkeane wrote:
I see we run this in C++ here, and get the same diagnostic. IMO, we should probably just modify the original diagnostic (`err_impcast_complex_scalar`?) to make `in C++` be a `select`, and modify the diagnostic conditions on 13082 to be more specific
https://github.com/llvm/llvm-project/pull/187954
More information about the cfe-commits
mailing list