Alan Munn explined in Use stylistic set variations only for certain glyphs how to enable glyph alternates for a certain subset of glyphs.
I'm using the second method he described (the other method isn't viable for me) and it seems to break automatic hyphenation.
Consider this example:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\usepackage[paperwidth = 6 em,right= 1 em,left= 1 em,]{geometry}
\begin{document}
A a h coherence
\end{document}
Here coherence is correctly hyphenated.
Now the same with alernates switched on:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\usepackage[paperwidth = 6 em,right= 1 em,left= 1 em,]{geometry}
% Now the more complicated version:
\XeTeXinterchartokenstate=1 % enable character classes
\newXeTeXintercharclass\myalt % create a new class
\XeTeXcharclass `\h \myalt % add h to the class
% between any character of class 0 and \myalt add the alternate feature
\XeTeXinterchartoks 0 \myalt = {\begingroup\addfontfeature{Alternate=0}}
% between \myalt and any character end the group
\XeTeXinterchartoks \myalt 0 = {\endgroup}
% between a word boundary and \myalt add the alternate feature
\XeTeXinterchartoks 255 \myalt = {\begingroup\addfontfeature{Alternate=0}}
% between \myalt and the word boundary end the group
\XeTeXinterchartoks \myalt 255 = {\endgroup}
\begin{document}
A a h coherence
\end{document}
Now hyphenation is broken.
Note that this is not an artifact of the specific example, I also tried it with a longer text.
Is this a bug?
EDIT: egreg explained that this is indeed not a bug.
Is a workaround possible? One obvious possibility is to mark hyphenation points explicitly (e.g. co-herence), but that is unpractical in a longer document.