An unused std::stack object with the default std::deque backend is not being eliminated. This is also true for GCC - see https://godbolt.org/z/749EGxjx1.
If you change the backend to std::vector it will be completely eliminated in Clang even if you pushed data into it. GCC will only completely eliminate it if it doesn't contain any data - see https://godbolt.org/z/fsacae58z.