\DocumentMetadata{
uncompress,
pdfversion=1.7,
lang=en-US,
testphase=phase-III
}
\documentclass{article}
\usepackage{etoc}
\begin{document}
\etocsetlinestyle{section}
{This is not in a TOCI}
{}
{}
{this neither thus \emph{CAUSES A PROBLEM}}
\tableofcontents
\section{One}
\section{Two}
\section{Three}
\section{Four}
\end{document}
raises on second compilation
Package tagpdf Warning: Parent-Child 'TOC/' --> 'Em/pdf2'.
(tagpdf) Relation is not allowed (struct 6, /TOC --> struct 15)
(tagpdf) on line 19
Very tempting to add a wont-fix. On the other hand it may be occasion to use the existing etoc internal stack of begins and ens to completely change current tagging strategy and invoke the contentsline upstream hooks from these begins and ends (starts and finishes) parts rather than from where they are currently.