Peel the pumpkin or squash and slice it thinly into pieces about 1-inch square (the size matters less than the thinness). Peel the apples and cut into slices, a little thicker than the pumpkin.
Preheat oven to 400F. Mix together the sugar, cinnamon, nutmeg, cloves, and cornstarch. Oil a 2-quart casserole dish. Arrange half of the pumpkin slices in the dish, and sprinkle with about 1/4 of the sugar mixture; arrange half of the apple slices over the pumpkin and sprinkle with a quarter of the sugar mixture. Repeat pumpkin and sugar and arrange the final layer of apples on top, heaping slightly in the center if necessary; sprinkle with remaining sugar mixture.
Cover with foil and bake for 40 minutes. Remove foil and bake for about another 15 minutes. Use a knife to lift up some of the apples and check to see that the pumpkin slices in the middle are completely done; if not, return to the oven until pumpkin is tender. Serve warm or cold.