mizvekov added inline comments.
================ Comment at: clang/lib/Sema/SemaDeclCXX.cpp:8664-8668 + if (QualType RT = FD->getDeclaredReturnType(); + DCK == DefaultedComparisonKind::ThreeWay && + RT->getContainedDeducedType() && + (!Context.hasSameType(RT, Context.getAutoDeductType()) || + RT->getContainedAutoType()->isConstrained())) { ---------------- ychen wrote: > mizvekov wrote: > > I think this might crash if the three-way comparison is defaulted with a > > deduced template specialization. > > > > Something like: > > ``` > > template <class> struct A {}; > > > > struct P { > > friend A operator<=>(const P&, const P&) = default; > > }; > > ``` > > > > The problem is that `RT->getContainedDeducedType()` will return non-null, > > because DTSTs are also deduced types, but `RT->getContainedAutoType()` will > > return null, because DTSTs are not AutoTypes. > > I think this might crash if the three-way comparison is defaulted with a > > deduced template specialization. > > The problem is that `RT->getContainedDeducedType()` will return non-null, > > because DTSTs are also deduced types, but `RT->getContainedAutoType()` will > > return null, because DTSTs are not AutoTypes. > > `RT->getContainedAutoType()` will be called only when `RT` is `AutoType`? Oh right, I see it now, there is a lot going on in that condition :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135088/new/ https://reviews.llvm.org/D135088 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits