The Fundamental Lemma of Calculus of Variation says that if a continuous function $f$ on an open interval $(a,b)$ satisfies the equality
$$\int_{a}^{b} f(x) h(x) = 0$$
for all compactly supported smooth functions $h$ on $(a,b)$ then $f$ is identically equal to zero.
Is it possible to weaken this statement by requiring this to only be true where $h$ is a polynomial by using Stone-Weierstrass? I think I am misunderstanding something because as far as I can tell it just follows immediately and I feel like the theorem would be stated like this instead if it were true.