title: Specify command-line C++ version for cl.exe (Visual Studio Code)
body: <p>I'm testing the C++17 <a href="https://en.cppreference.com/w/cpp/language/attributes/fallthrough" rel="nofollow noreferrer">fallthrough</a> attribute in Visual Studio Code. The IDE has been configured to compile C/C++ code using the Microsoft Visual Studio cl.exe compiler. My task definition (in <code>tasks.json</code>) to build a simple <code>.cpp</code> file in DEBUG mode is:</p>
  <pre><code>{
      &quot;type&quot;: &quot;shell&quot;,
      &quot;label&quot;: &quot;cl.exe: Build active file&quot;,
      &quot;command&quot;: &quot;cl.exe&quot;,
      &quot;args&quot;: [
          &quot;/Zi&quot;,
          &quot;/EHsc&quot;,
          &quot;/Fe:&quot;,
          &quot;${file}&quot;,
          &quot;/link&quot;,
          &quot;/OUT:${fileDirname}\\${fileBasenameNoExtension}.exe&quot;
      ],
      &quot;options&quot;: {
          &quot;cwd&quot;: &quot;${workspaceFolder}&quot;
      },
      &quot;problemMatcher&quot;: [
          &quot;$msCompile&quot;
      ]
  }
  </code></pre>
  <p>This has been tested on several programs and works well. Now I include a <code>switch</code> statement using the new <code>[[fallthrough]];</code> attribute and the compiler generates:</p>
  <pre><code>warning C5051: attribute 'fallthrough' requires at least '/std:c++17'; ignored
  </code></pre>
  <p>Adding <code>&quot;/std:c++17&quot;,</code> to the &quot;args&quot; for cl.exe changed nothing (the same compiler warning is generated). Here is the new version:</p>
  <pre><code>&quot;args&quot;: [
      &quot;/Zi&quot;,
      &quot;/EHsc&quot;,
      &quot;/Fe:&quot;,
      &quot;/std:c++17&quot;,
      &quot;${file}&quot;,
      &quot;/link&quot;,
      &quot;/OUT:${fileDirname}\\${fileBasenameNoExtension}.exe&quot;
  ],
  </code></pre>
  <p>As far as I can see, my syntax is correct according to the <a href="https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version" rel="nofollow noreferrer">Microsoft documentation</a> for specifying the language standard.</p>
  <p>What am I doing wrong?</p>