[PATCH] D135557: Add needsImplicitDefaultConstructor and friends

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 09:30:04 PDT 2022


aaron.ballman added a comment.

In D135557#3871482 <https://reviews.llvm.org/D135557#3871482>, @dblaikie wrote:

> I was hoping the rephrasing (is this really a question about which ctors the type has, or about how the type can be constructible) might offer us a way out for this use case, at least - if it's about how the type is constructible, then the AST wouldn't be the ideal/complete solution anyway and we could move more towards exposing the 5 special member ops as "can I do this thing/would this expression be valid".

FWIW, I'm about 99% sure there's no way to do that without use of `Sema`, which would require significant work to expose to the C indexing APIs and to AST matchers. At the AST level, we have "does this type have these methods" but it requires semantic analysis to determine whether something is copy constructible or not. e.g.,

  struct S {
    S(S&) {}
  };

This class has a usable copy constructor, yet it is not copy constructible per the type trait: https://godbolt.org/z/srefPjzxj


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135557



More information about the cfe-commits mailing list