2

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"
    }
}
Rakete1111
  • 47,013
  • 16
  • 123
  • 162
Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183

0 Answers0