{"id":110045,"date":"2024-07-25T07:00:00","date_gmt":"2024-07-25T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=110045"},"modified":"2024-07-25T13:50:29","modified_gmt":"2024-07-25T20:50:29","slug":"20240725-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240725-00\/?p=110045","title":{"rendered":"In my Visual Studio project, I set my Conformance mode to permissive, but it&#8217;s still not permissive"},"content":{"rendered":"<p>Visual Studio lets you <a title=\"MSVC conformance improvements in Visual Studio 2017 version 15.5\" href=\"https:\/\/devblogs.microsoft.com\/cppblog\/msvc-conformance-improvements-in-visual-studio-2017-version-15-5\/\"> configure the conformance mode of your C++ project<\/a> under Configuration Properties, C\/C++, Language, Conformance mode. But if you set it to &#8220;No (\/permissive)&#8221;, it might still not be permissive. What&#8217;s going on?<\/p>\n<p><a title=\"\/permissive- (Standards conformance)\" href=\"https:\/\/learn.microsoft.com\/cpp\/build\/reference\/permissive-standards-conformance?view=msvc-170\"> The documentation for the <tt>\/permissive<\/tt> flag<\/a> says<\/p>\n<blockquote class=\"q\"><p>The <tt>\/permissive-<\/tt> option is implicitly set by the <tt>\/std:c++latest<\/tt> option starting in Visual Studio 2019 version 16.8, and in version 16.11 by the <tt>\/std:c++20<\/tt> option. \u2026 The <tt>\/permissive<\/tt> option must come after any option that sets <tt>\/permissive-<\/tt> implicitly.<\/p><\/blockquote>\n<p>I created a project, set the C++ Language Standard to &#8220;ISO C++20 Standard (\/std:c++20)&#8221;, and set the Conformance mode to &#8220;No (\/permissive)&#8221;. I confirmed that the compiler was still not running in permissive mode by using the first example on the page and seeing whether the compiler accepted it.<\/p>\n<p>After confirming that permissive mode was disabled, I looked at the Command Line page to see what flags were ultimately being passed to the compiler. My guess was that the <tt>\/permissive<\/tt> flag was being passed too soon, and was being subsequently being turned off by the <tt>\/std:c++20<\/tt> flag.<\/p>\n<p>And my theory was correct:<\/p>\n<pre style=\"white-space: pre-wrap;\">\/JMC <span style=\"border: solid 1px currentcolor;\">\/permissive<\/span> \/ifcOutput \"x64\\Debug\\\" \/GS \/Wall \/Zc:wchar_t \/ZI \/Gm- \/Od \/sdl \/Fd\"x64\\Debug\\vc143.pdb\" \/Zc:inline \/fp:precise \/D \"_DEBUG\" \/D \"_CONSOLE\" \/D \"_UNICODE\" \/D \"UNICODE\" \/errorReport:prompt \/WX- \/Zc:forScope \/RTC1 \/Gd \/MDd <span style=\"border: solid 1px currentcolor;\">\/std:c++20<\/span> \/FC \/Fa\"x64\\Debug\\\" \/EHsc \/nologo \/Fo\"x64\\Debug\\\" \/Fp\"x64\\Debug\\Test.pch\" \/diagnostics:column\r\n<\/pre>\n<p>The solution was to add <tt>\/permissive<\/tt> as an explicit flag in the &#8220;Additional Options&#8221; box at the bottom. These flags appear to go at the end, so we can turn permissive mode back on after the <tt>\/std:c++20<\/tt> flag turned it off.<\/p>\n<p>This is arguably a bug in the build system (putting the ConformanceMode property too early on the command line), but at least now you have a workaround.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Digging into what the compiler sees.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-110045","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Digging into what the compiler sees.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=110045"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110045\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=110045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=110045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=110045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}