invalid C++ codegen in `--mm:refc` with `Thread`/`Atomic`/`createThread`
### Description

```nim
import std/atomics
type N = object
  u: ptr Atomic[int]
proc w(args: N) = discard
var e: Thread[N]
createThread(e, w, default(N))
```

compile with `nim cpp --mm:refc r.nim`

### Nim Version

`v2.0.8`:
```
Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-09-23
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release
```

`version-2-0`:
```
Nim Compiler Version 2.0.9 [Linux: amd64]
Compiled at 2024-09-23
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 27381cc60213e19aa34664176bd358ca5e45bd5a
active boot switches: -d:release
```

`version-2-2`:
```
Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-23
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 755307be61e4ee7b32c8354b2c303d04bdfc3a3e
active boot switches: -d:release
```

`devel`:
```
Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-23
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: a55c15c651b805c5eca4475f9845a57adf6cddef
active boot switches: -d:release
```

### Current Output

```text
In file included from /usr/include/strings.h:23,
                 from /usr/include/string.h:462,
                 from .cache/nim/r_d/@mr.nim.cpp:10:
.cache/nim/r_d/@mr.nim.cpp: In function ‘void atmrdotnim_DatInit000()’:
.cache/nim/r_d/@mr.nim.cpp:207:82: error: ‘TY__HdySGEQ1I0yaP9bnrEvY9bpQ’ {aka ‘struct std::atomic<long int>’} has no member named ‘raw’
  207 | TM__O9ck8QE34G7SWmidGMuOitg_0[1].offset = offsetof(TY__HdySGEQ1I0yaP9bnrEvY9bpQ, raw);
      |                                                                                  ^~~
Error: execution of an external compiler program 'g++ -c -std=gnu++17 -funsigned-char  -w -fmax-errors=3 -fpermissive -pthread   -I/home/user/nimdevel/lib -I/tmp -o .cache/nim/r_d/@mr.nim.cpp.o .cache/nim/r_d/@mr.nim.cpp' failed with exit code: 1
```


### Expected Output

```text
No invalid C++ codegen
```


### Known Workarounds

_No response_

### Additional Information

_No response_