The results of a search for charged Higgs bosons decaying to a τ lepton and a neutrino, H ± → τ ± ν, are presented. The analysis is based on 19.5 fb−1 of proton-proton collision data at s√ = 8 TeV collected by the ATLAS experiment at the Large Hadron Collider. Charged Higgs bosons are searched for in events consistent with top-quark pair production or in associated production with a top quark, depending on the considered H ± mass. The final state is characterised by the presence of a hadronic τ decay, missing transverse momentum, b-tagged jets, a hadronically decaying W boson, and the absence of any isolated electrons or muons with high transverse momenta. The data are consistent with the expected background from Standard Model processes. A statistical analysis leads to 95% confidence-level upper limits on the product of branching ratios ℬ(t → bH ±) × ℬ(H ± → τ ± ν), between 0.23% and 1.3% for charged Higgs boson masses in the range 80-160GeV. It also leads to 95% confidence-level upper limits on the production cross section times branching ratio, σ(pp → tH ± + X) × ℬ(H ± → τ ± ν), between 0.76 pb and 4.5 fb, for charged Higgs boson masses ranging from 180 GeV to 1000 GeV. In the context of different scenarios of the Minimal Supersymmetric Standard Model, these results exclude nearly all values of tan β above one for charged Higgs boson masses between 80 GeV and 160 GeV, and exclude a region of parameter space with high tan β for H ± masses between 200 GeV and 250 GeV.