ArcsinX marked 3 inline comments 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:
> ArcsinX wrote:
> > 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()`)
> Okay I see it now. Thank you.
> 
> I think it would be better to only call `TryRefInitWithConversionFunction` in 
> C++ mode since conversion functions don't exist in C (only the first call on 
> line 4773).
Agree. Fixed.


================
Comment at: clang/lib/Sema/SemaInit.cpp:4706
                                            Qualifiers T2Quals,
                                            InitializationSequence &Sequence) {
   QualType DestType = Entity.getType();
----------------
riccibruno wrote:
> Can you add a comment here explaining that we can get there in C with some 
> builtins?
Added extra description for TryReferenceInitializationCore() with explanation 
that we can get here in C.


================
Comment at: clang/lib/Sema/SemaInit.cpp:4773
     if (RefRelationship == Sema::Ref_Incompatible && T2->isRecordType() &&
         (isLValueRef || InitCategory.isRValue())) {
       ConvOvlResult = TryRefInitWithConversionFunction(
----------------
riccibruno wrote:
> Here
Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82805



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

Reply via email to