G++-13 in snapcraft

How do I configure snapcraft.yaml to use g+±13 ?

If I specify

    build-packages:
	    - g++-13

I get the message:

Could not find a required package in 'build-packages': g++-13

You need to understand how snap bases work: For example, base: 22 corresponds to Ubuntu 22.04LTS and makes the packages from that archive available. As Ubuntu 22.04LTS predates g++13, the g++-13 package isn’t available from that archive.

It is already possible to use base: 24 for testing, and that does include g++13.

Alternatively, you could add a PPA containing g++13 to your snap recipe. Such as https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test.