jankratochvil added a comment.

  cat >1.cpp <<EOH
  template <typename T> struct DWrapper {};
  typedef DWrapper<void> DW;
  struct B {
    DW spd;
  } b;
  struct E {
    B &b_ref = b;
    static DW f() { return {}; }
  } e;
  EOH
  $ (set -ex;./bin/clang -c -o 1.o 1.cpp -Wall -g;./bin/lldb -b ./1.o -o 'p E' 
-o 'p e')
  (lldb) p E
  (lldb) p e
  lldb: .../clang/lib/AST/Decl.cpp:4188: bool 
clang::FieldDecl::isZeroSize(const clang::ASTContext &) const: Assertion 
`isInvalidDecl() && "valid field has incomplete type"' failed.

So importing just the type `E` is insufficient but I somehow cannot import the 
variable `e`:

    auto *FromE = FirstDeclMatcher<VarDecl>().match(FromTU, 
varDecl(hasName("e")));
  ...
    // ASTTests: .../llvm/include/llvm/Support/Casting.h:269: typename 
cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = clang::DeclContext, Y = 
clang::Decl]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible 
type!"' failed.
    llvm::Error Err = findFromTU(FromE)->Importer->ImportDefinition(FromE);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101236

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

Reply via email to