[PATCH] D137787: [CodeGen] Relax assertion on generating destructor call

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 07:55:33 PST 2022


Hahnfeld added a comment.

I've trimmed the failing code down to

  #include <string>
  #include <string_view>
  #include <vector>
  
  template <typename T>
  struct SO {
    void a() {
      struct SI {
        std::vector<int> v;
      };
      SI s;
      SI m(std::move(s));
    }
  
    void g() {
      std::vector<std::string_view> v{"a"};
    }
  };

in a header / module and

  SO<int> s;
  s.a();
  s.g();

in the calling code. Sadly this works fine in standalone Clang...

All of the above code seems to be important, starting from the outer `template`, having two functions, moving a `std::vector` from a default generated move constructor and then constructing a `std::vector<std::string_view>` with at least one element. If this rings a bell for anybody or anybody has an idea where to go from here, please let me know. I'm out of depth how to produce the exact failing conditions in a test. I would argue that relaxing the `assert` is fine regardless because it still tests that the `DtorDecl` belongs to this type, but I can't articulate why an exact pointer comparison fails in very rare circumstances...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137787



More information about the cfe-commits mailing list