Update Visual Studio Code error squiggles to C++ 17

☆樱花仙子☆ 提交于 2019-12-23 03:58:10

问题


In Visual Studio Code, I created the following file:

#include <iostream>
using namespace std;

template <auto value> void g() {  // requires c++17
    cout << "g " << value << endl;
}

int main() {
    g<10>();     // deduces int; requires c++17
}

In the editor, the "g" in the before-last line has a red underline, and the error message says:

no instance of function template "g" matches the argument list
template<<error-type> value> void g()

I guess this is because the code uses a new feature introduced in C++17. How can I make the error-squiggle mechanism use C++17?

NOTE: I run the code from within Visual Studio Code using the Run Code extension with the following settings file:

{

    "code-runner.executorMap": {
        "cpp": "clang++-5.0 -std=c++17 $fullFileName && ./a.out"
    }
}

来源:https://stackoverflow.com/questions/48283026/update-visual-studio-code-error-squiggles-to-c-17

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!