Context. Oscillation experiments yield strong evidence that at least some neutrinos are massive. As a hot dark-matter component, massive neutrinos should modify the expansion history of the Universe as well as the evolution of cosmological perturbations, in a different way from cold dark matter or dark energy. Aims. We use the latest release of CFHTLS cosmic-shear data to constrain the sum of the masses m ν of neutrinos, assuming three degenerate mass states. We also consider a joint analysis including other cosmological observables, notably CMB anisotropies, baryonic acoustic oscillations, and distance modulus from type Ia supernovae. Methods. Combining CAMB with a lensing code, we compute the aperture mass variance using a suitable recipe to deal with matter perturbations in the non-linear regime. The statistical analysis is performed by sampling an 8-dimensional likelihood on a regular grid as well as using the importance sampling technique. Results. We obtain the first constraint on neutrino masses based on cosmic-shear data, and combine CFHTLS with WMAP, SDSS, 2dFGRS, Gold-set, and SNLS data. The joint analysis yields 0.03 eV < m ν < 0.54 eV at the 95% confidence level. The preference for massive neutrinos vanishes when systematics are included.