Dietary restriction extends lifespan in a wide variety of animals, including Drosophila, but its relationship to functional and cognitive aging is unclear. Here, we study the effects of dietary yeast content on fly performance in an aversive learning task (association between odor and mechanical shock). Learning performance declined at old age, but 50-day-old dietary-restricted flies learned as poorly as equal-aged flies maintained on yeast-rich diet, even though the former lived on average 9 days (14%) longer. Furthermore, at the middle age of 21 days, flies on low-yeast diets showed poorer short-term (5 min) memory than flies on rich diet. In contrast, dietary restriction enhanced 60-min memory of young (5 days old) flies. Thus, while dietary restriction had complex effects on learning performance in young to middle-aged flies, it did not attenuate aging-related decline of aversive learning performance. These results are consistent with the hypothesis that, in Drosophila, dietary restriction reduces mortality and thus leads to lifespan extension, but does not affect the rate with which somatic damage relevant for cognitive performance accumulates with age.