How does clang, a C++ compiler that is itself written in C++, use <feature from C++> that it is itself implementing?
Why wouldn’t it be able to?
I don’t understand how your question specifically relates to garbage collection, or why the compiler would need to avoid it. The Go compiler is a normal Go program and garbage collection works in it the same way it does in any other Go program.