The latest Raspberry OS comes with GCC 10, which is seriously outdated by now.
apt does not know of any versions beyond
gcc-10. How should I get a newer version onto the system? Is there an unofficial repo I can add to
apt with updated GCC/G++ that's built for Pi?
Raspberry Pi OS is based on Debian which is a conservative OS i.e. it changes infrequently after EXTENSIVE testing (and as a consequence works).
Raspberry Pi Ltd. does not do its own software (except Pi specific code for firmware) and uses the Debian code (although the 32bit OS uses recompiled code for ARM6).
Debian Bookworm has been released (and uses gcc12). The official Pi version is probably months away (I am running testing).
If you want cutting edge software use a different OS.