Consider
\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
\texttt{\string\iftrue}
%% \texttt =\long macro:
%% #1->\ifmmode
%% \nfss@text{\ttfamily#1}
%% \else
%% \hmode@bgroup\text@command{#1}\ttfamily\check@icl#1\check@icr\expandafter\egroup
%% \fi
\end{document}
Processing this minimal example with pdflatex results in a rather nasty Incomplete \ifmmode error during the expansion of \texttt{\string\iftrue}. It seems to me that \string does not totally prevent TeX from taking account of \iftrue as a conditional. (The same is true for \detokenize, by the way.)
Can anybody explain what is precisely going on?
Addendum: Note that the error would disappear if \texttt stored its argument in an auxiliary macro before processing it.
