rjmccall added inline comments.

================
Comment at: clang/lib/Sema/SemaCast.cpp:2236
+    }
+  }
+
----------------
The expected semantics for this conversion are not the ordinary 
bitwise-reinterpretation semantics of `reinterpret_cast`, so this really should 
not be allowed as a `reinterpret_cast`.  Allowing it as a `static_cast` seems 
appropriate.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:7315
+/// is not a scalar type.
+bool Sema::areCompatibleMatrixTypes(QualType srcTy, QualType destTy) {
+  assert(destTy->isMatrixType() && srcTy->isMatrixType());
----------------
"Compatible" has a specific meaning in the C standard, so if you aren't 
intending to invoke that concept of compatibility, you should find a new word.

It looks like this kind of cast is supposed to be doing an elementwise 
conversion.  I guess all the types you can have matrices of are 
interconvertible, so there are no restrictions on the element types.  But you 
definitely need this to produce a new `CastKind` for elementwise conversion 
instead of using `CK_BitCast`, which does a bitwise reinterpretation, which is 
not what you want.

Matrix element types already have to be scalar types, so those checks aren't 
doing anything.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99037/new/

https://reviews.llvm.org/D99037

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to