================ @@ -2601,10 +2601,11 @@ class CXXConstructorDecl final void anchor() override; size_t numTrailingObjects(OverloadToken<InheritedConstructor>) const { - return CXXConstructorDeclBits.IsInheritingConstructor; + return getCanonicalDecl()->CXXConstructorDeclBits.IsInheritingConstructor; } size_t numTrailingObjects(OverloadToken<ExplicitSpecifier>) const { - return CXXConstructorDeclBits.HasTrailingExplicitSpecifier; + return getCanonicalDecl() + ->CXXConstructorDeclBits.HasTrailingExplicitSpecifier; ---------------- cor3ntin wrote:
This change does not look quite correct. Indeed `numTrailingObjects` is an internal detail of the object that should preserve its invariants. i.e, it is exactly whether an explicit specifier is **stored** as a trailing object of this object. However, you are most probably on the right path. In `ASTWriterDecl`, `addExplicitSpecifier(D->getExplicitSpecifier(), Record);` does indeed look incorrect. Because again, we are trying to serialize that object - not parts that are stored in an other canonicl decl. I think the solution might be as simple as replacing that line with `addExplicitSpecifier(D->getExplicitSpecifierInternal(), Record);` (`getExplicitSpecifierInternal()` does not call `getCanonicalDecl()`) https://github.com/llvm/llvm-project/pull/133077 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits