Would a car that was produced last year but bought this year be accounted for in the GDP? The equation for the GDP is: $$C+I+G+(X-M)$$
If consumers are buying new cars produced last year...would those still be included in the GDP?
GDP is actual production. Since the car was produced last year, it adds to last year's GDP.  Since it wasn't sold, it would show up in inventory investment (which seems to be included in I in your equation). This year, when the car is sold, inventory investment goes down and consumption goes up by an equal amount, so there is no effect on GDP.
Pop quiz: analyze this example using the income approach to GDP.