Nutritional variation across the lifetime can have significant and sex-specific impacts on fitness. Using Drosophila melanogaster, we measured these impacts by testing the effects on life span and reproductive success of high or low yeast content in developmental versus adult diets, separately for each sex. We tested two hypotheses: that dietary mismatches between development and adulthood are costly and that any such costs are sex-specific. Overall, the results revealed the rich and complex responses of each sex to dietary variation across the lifetime. Contrary to the first hypothesis, dietary mismatches between developmental and adult life stages were not universally costly. Where costs of nutritional variation across the life course did occur, they were sex-, context-, and trait-specific, consistent with hypothesis 2. We found effects of mismatches between developmental and adult diets on reproductive success in females but not males. Adult diet was the main determinant of survival, and life span was significantly longer on high yeast adult food, in comparison to low, in both sexes. Developing on a high yeast diet also benefited adult female life span and reproductive success, regardless of adult diet. In contrast, a high yeast developmental diet was only beneficial for male life span when it was followed by low yeast adult food. Adult diet affected mating frequency in opposing directions, with males having higher mating frequency on high and females on low, with no interaction with developmental diet for either sex. The results emphasize the importance of sex differences and of the directionality of dietary mismatches in the responses to nutritional variation.