When you say that you're using code completion plugin do you mean the older plugin named "code completion" or the newer code completion plugin called "Clangd_client" plugin?
If you're using the older, try using the newer clangd_client plugin.
See
https://wiki.codeblocks.org/index.php/CB_Clangd_Clientfor directions.
This requires you to install a Clangd.exe process. It's explained in the wiki. I'd suggest using the section entitled " MSYS2 Compiler - MinGW64". For me, I just installed the whole Msys2/Mingw64 system, then told it to install clangd.
It did all the work installing dependencies for me.
You'll be happy you did. Msys2/Mingw64 is so useful for so many other windows tools and libs.
Once clangd.exe is installed, go to MainMenu>plugins>Manager plugins. Disable "Code completion" and enable Clangd_client. then restart CodeBlocks. You'll get a message saying you need to tell Clangd client plugin where clangd.exe is. It'll be in the Mingw64/bin/ folder.
If you're already using the newer clangd plugin, would you also upload the .h files so I can try to re-create the problem you described.
The old Code completion plugin is very old and has problems with code using C++11 or higher. Clangd is now used in most modern IDE(s).
Let me know how you progress...
Regards