Is it possible to use g++ as the compiler?

I’m using clangd on macOS; my compile_commands.json looks like this:

[
 {
  "directory": "xxx",
  "arguments": [
   "/usr/local/bin/g++-10",
   "-std=c++17",
   "-O2",
   "-Wall",
   "-Wextra",
   "-pedantic",
   "-Wshadow",
   "-Wformat=2",
   "-Wfloat-equal",
   "-Wconversion",
   "-Wlogical-op",
   "-Wshift-overflow=2",
   "-Wduplicated-cond",
   "-Wcast-qual",
   "-Wcast-align",
   "-Wno-unused-result",
   "-Wno-sign-conversion",
   "-fsanitize=address",
   "-fsanitize=undefined",
   "-fsanitize=float-divide-by-zero",
   "-fsanitize=float-cast-overflow",
   "-fno-sanitize-recover=all",
   "-fstack-protector-all",
   "-D_FORTIFY_SOURCE=2",
   "-D_GLIBCXX_DEBUG",
   "-D_GLIBCXX_DEBUG_PEDANTIC",
   "-isystem",
   ".precompiled_headers",
   "xxx.cpp",
   "-o",
   "xxx"
  ],
  "file": "xxx.cpp"
 }
]

But clangd still uses clang as the default compiler…

But clangd still uses clang as the default compiler

Can you elaborate on exactly what you mean by this? Clangd does not involve any external compiler.

clangd uses clang’s parser library to understand the code, generate diagnostics instead. It’s not possible to avoid this, it’s at the core of clangd’s design.

I didn’t know how clangd worked… Sorry for the dumb question.
Here’s what bothers me. I do competitive programming and I work with gcc on single files. When I use the header stdc++.h from gcc (<bits/stdc++.h> in C++ - GeeksforGeeks), the error below pops up:

In included file: definition of builtin function '_mm_getcsr' /usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin19/10.2.0/include/xmmintrin.h:821:1: note    : error occurred here [builtin_definition]

So _mm_getcsr seems to be a gcc-specific function which clang doesn’t include (https://bugreports.qt.io/browse/QTCREATORBUG-20903).
Is there someway to solve this?

Everything works fine when I switch to ubuntu with similar configuration. Does it have something to do with macs?