  We study a relationship between conformally invariant boundary conditions and
anomalies of conformal field theories (CFTs) in 1+1 dimensions. For a given CFT
with a global symmetry, we consider symmetric gapping potentials which are
relevant perturbations to the CFT. If a gapping potential is introduced only in
a subregion of the system, it provides a certain boundary condition to the CFT.
From this equivalence, if there exists a Cardy boundary state which is
invariant under a symmetry, then the CFT can be gapped with a unique ground
state by adding the corresponding gapping potential. This means that the
symmetry of the CFT is anomaly free. Using this approach, we systematically
deduce the anomaly-free conditions for various types of CFTs with several
different symmetries. They include the free compact boson theory,
Wess-Zumino-Witten models, and unitary minimal models. When the symmetry of the
CFT is anomalous, it implies a Lieb-Schultz-Mattis type ingappability of the
system. Our results are consistent with, where available, known results in the
literature. Moreover, we extend the discussion to other symmetries including
spin groups and generalized time-reversal symmetries.
