Disable specific clangd error from syntax highlighting

I'm using MSVC compiler with CLion, and have some code that looks like this:

void fn(std::vector<int>& input) { do the stuff.. }

fn({1, 2, 3});
fn(vector<int>{1, 2, 3});

This code compiles on MSVC (because they aren't adhering to the official spec?), but is an error according to clang, thus my code gets a red underline with the following error:

non-const lvalue reference to type 'vector<int>' cannot bind to temporary of type 'vector<int>'

I have no intention of porting my code from MSVC to another compiler. I don't want to change the function signature because sometimes I will pass a large array to this function that isn't defined inline, and I prefer to use this syntax for calling the function because it beats declaring a vector<int> and then passing it to the function.

So, is it possible to disable that specific type of error from being syntax-highlighted? Or alternatively, connect to a MSVC language server?

0

请先登录再写评论。