Link simple executable on macos using clang 14

Hi, I’m trying to compile a simple executable using Clang 14 on MacOS. Here’s my shell:

  pkgs = import <nixpkgs> {};
  stdenv = pkgs.llvmPackages_12.stdenv;
stdenv.mkDerivation {
  name = "nix-shell";
  phases = ["nobuildPhase"];
  buildInputs = with pkgs; [cmake ninja];
    nobuildPhase = ''
    echo "This derivation is not meant to be built, aborting";
    exit 1

Here test.cpp:

#include <new>
int main() {
        auto t = new int{0};
        throw *t;

I enter the shell then I type the command clang++ -O0 test.cpp.

It seem to not link against any C++ stuff since I get this output:

Undefined symbols for architecture arm64:
  "operator new(unsigned long)", referenced from:
      _main in test-40a1fe.o
  "___cxa_allocate_exception", referenced from:
      _main in test-40a1fe.o
  "___cxa_throw", referenced from:
      _main in test-40a1fe.o
ld: symbol(s) not found for architecture arm64
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

I also tried with clang 13 and 12. Only clang 11 seem to work properly.

Is there a way to make it link properly or only clang 11 is supported? Thanks.