================
@@ -129,19 +207,19 @@ auto inPlaceClass() {
 
 auto isOptionalNulloptConstructor() {
   return cxxConstructExpr(
-      hasOptionalType(),
+      hasOptionalOrDerivedType(),
----------------
martinboehme wrote:

> I would think that we don't know (and therefore can't model) the definition 
> of constructors, methods, operators on the derived class.

I agree in principle, but here we're looking specifically at a constructor that 
takes a `std::nullopt_t`. I'd say it's a pretty safe bet to assume this 
constructor is initializing the optional to be empty, even in a derived class 
(it would be _very_ confusing if it did anything else).

I believe it's also reasonable to conjecture about the behavior of the cases 
below that use `hasOptionalOrDerivedType()`, i.e. the `std::in_place_t` case 
and the "value or conversion constructor / assignment" cases.

`llvm::MaybeAlign` has 
[methods](https://github.com/llvm/llvm-project/blob/3e6db602918435b6a5ac476f63f8b259e7e73af4/llvm/include/llvm/Support/Alignment.h#L131)
 that correspond to these cases, and it seems desirable to model them correctly.

https://github.com/llvm/llvm-project/pull/84138
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to