Certain types of floating bodies are known to support trapped modes, with oscillatory fluid motion near the body and no energy radiation in the far field. Previous work has considered either fixed bodies, where the boundary conditions are homogeneous, or bodies which are freely floating and moving without any exciting force. For a fixed body the existence of a trapped mode implies that there is no unique solution of the boundary-value problem for the velocity potential with a prescribed body motion. For a free body which supports a trapped mode, the solution of the coupled problem for the motions of the fluid and body does not have a unique solution. A more general case is considered here, of a body with a linear restoring force such as an elastic mooring. The limiting cases of a fixed and free body correspond to infinite or zero values of the corresponding spring constant. A variety of body shapes are found including cylinders in two dimensions and axisymmetric bodies in three dimensions, which illustrate this more general case of trapping and provide a connection between the fixed and free cases.