[PATCH] D82805: [clang] Fix a crash on passing C structure of incompatible type to function with reference parameter

Aleksandr Platonov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 15:18:30 PDT 2020


ArcsinX marked an inline comment as done.
ArcsinX added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:4539
+    if (CXXRecordDecl *T2RecordDecl =
+        dyn_cast<CXXRecordDecl>(T2RecordType->getDecl())) {
+      const auto &Conversions = T2RecordDecl->getVisibleConversionFunctions();
----------------
riccibruno wrote:
> I cannot reproduce this with the provided test case. Can you explain why `T2RecordDecl` would not be a `CXXRecordDecl` since we should only get there with c++?
You can reproduce it with
```
bin/clang -xc --target=arm-unknown-gnu -c ../clang/test/Sema/init-ref-c.c
```

We can get there with C in case of using builtins declared as functions with reference parameters (e.g. `__builtin_va_end()`)


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

https://reviews.llvm.org/D82805





More information about the cfe-commits mailing list