A quick google search gives many hits for people with "opinions" that leaving children alone in cars is illegal, with suggested age ranges between 6 and 16. I personally think it should be illegal to leave toddlers unattended, even for two minutes, if they will be out of the parent's line of sight.
But for me, older kids would be a case-by-case decision. Is the child of normal intelligence, understands stranger danger, displays common sense, is trustworthy? We do raise our children toward eventual independence, so isn't it reasonable to give them age-appropriate opportunities to exercise good judgement?
Curious about the actual laws pertaining to this issue, I dug deeper, and found an undated news bulletin from a California sheriff's office, noting that 11 states make it illegal to leave a child (no ages mentioned) in a car, citing the primary danger of death by overheating, but also other types of injuries, carjacking, car fires, or carbon monoxide poisoning in a car left running.
Further, California DMV states the following sensible rule:
It is illegal to leave a child SIX YEARS OF AGE OR YOUNGER unattended in a motor vehicle WHEN:
* There are conditions that present a significant risk to the child's health or safety. Example: Leaving a child in a closed car on a very hot day.
* The vehicle's engine is running, the keys are in the ignition, or both. Children can start or move the car causing injuries and/or deaths to themselves or others. An opportunist may (and many have) seize the moment to jump in and drive your car away, child still strapped in.
Violators may be fined and required to attend a community education program. If the child is injured, requires emergency medical services, or dies, then the penalties become more severe.
Also remember that pets also deserve the same care and should not be left unattended in a vehicle on a hot day.
If you see an endangered child or pet, call 911 and stay by the vehicle.
ADDED: For those curious about the legislative efforts of various states related to children and automobiles, here's a good starting point:
http://www.kidsandcars.org/legislation.html