title: Disable every single gcc extensions (C++)
body: <p>The title is quite clear, is there a way to disable every single non-standard feature of gcc (extension) when compiling some C++ code. I've previously always used <code>-pedantic-errors</code> alongside <code>-Wall</code> and <code>-Wextra</code>, the first according to the gcc man page does the following</p>
  <blockquote>
  <p>Give an error whenever the base standard (see -Wpedantic) requires a diagnostic, in some
  equivalent to -Werror=pedantic, since there are errors enabled by this option and not
  particular library's limitations.  However, if -Wpedantic is used with -Wformat, warnings
  made into an error by -pedantic-errors.
  -Wall or -Wpedantic.</p>
  </blockquote>
  <p>As a result it disables practically all extensions that aren't standard conforming, however. I was rather shooked that the following code compiles with gcc</p>
  <pre><code>void foo(std::vector&lt;auto&gt;) { ... }
  </code></pre>
  <p>with the <code>-std=c++20</code> flag, if we bump it down to <code>-std=c++17</code> we receive an error message prompting the use of <code>-std=c++20</code> as it's a &quot;c++20 feature&quot;. However neither clang or msvc is willing to compile this. After some further research I was notified of the following</p>
  <blockquote>
  <p>This is a GCC extension and accepted by design.</p>
  </blockquote>
  <p>Which is rather upsetting as even the safe-guards of <code>-pedantic-errors</code>, <code>-Wall</code> and <code>-Wextra</code> didn't pick this up, which leads me to question what other extensions might be silently passed through by gcc. Thus the question comes; is there any way to disable exactly every gcc extension?</p>
  <p><strong>Edit</strong>: From the comment section of <a href="https://stackoverflow.com/questions/38939991/how-to-disable-gnu-c-extensions">How to disable GNU C extensions?</a></p>
  <blockquote>
  <p>You cannot</p>
  </blockquote>