<small id='K2ITq'></small><noframes id='K2ITq'>

    <tfoot id='K2ITq'></tfoot>
  1. <i id='K2ITq'><tr id='K2ITq'><dt id='K2ITq'><q id='K2ITq'><span id='K2ITq'><b id='K2ITq'><form id='K2ITq'><ins id='K2ITq'></ins><ul id='K2ITq'></ul><sub id='K2ITq'></sub></form><legend id='K2ITq'></legend><bdo id='K2ITq'><pre id='K2ITq'><center id='K2ITq'></center></pre></bdo></b><th id='K2ITq'></th></span></q></dt></tr></i><div id='K2ITq'><tfoot id='K2ITq'></tfoot><dl id='K2ITq'><fieldset id='K2ITq'></fieldset></dl></div>

        <bdo id='K2ITq'></bdo><ul id='K2ITq'></ul>
      <legend id='K2ITq'><style id='K2ITq'><dir id='K2ITq'><q id='K2ITq'></q></dir></style></legend>

      (已知)VC12 中的编译器错误?

      时间:2023-10-05
    1. <i id='HmSq3'><tr id='HmSq3'><dt id='HmSq3'><q id='HmSq3'><span id='HmSq3'><b id='HmSq3'><form id='HmSq3'><ins id='HmSq3'></ins><ul id='HmSq3'></ul><sub id='HmSq3'></sub></form><legend id='HmSq3'></legend><bdo id='HmSq3'><pre id='HmSq3'><center id='HmSq3'></center></pre></bdo></b><th id='HmSq3'></th></span></q></dt></tr></i><div id='HmSq3'><tfoot id='HmSq3'></tfoot><dl id='HmSq3'><fieldset id='HmSq3'></fieldset></dl></div>

            <bdo id='HmSq3'></bdo><ul id='HmSq3'></ul>
          • <small id='HmSq3'></small><noframes id='HmSq3'>

          • <tfoot id='HmSq3'></tfoot>
              <tbody id='HmSq3'></tbody>

              1. <legend id='HmSq3'><style id='HmSq3'><dir id='HmSq3'><q id='HmSq3'></q></dir></style></legend>
              2. 本文介绍了(已知)VC12 中的编译器错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                此程序在使用 VC12(在 Visual Studio 2013 RTM 中)编译时[1] 导致崩溃(在所有构建配置中),而实际上不应该:

                This program, when compiled with VC12 (in Visual Studio 2013 RTM)[1] leads to a crash (in all build configurations), when really it shouldn't:

                #include <string>
                
                void foo(std::string const& oops = {})
                {
                }
                
                int main()
                {
                    foo();
                }
                

                我知道可能有两个无声的不良代码生成错误:

                I know of two silent bad codegen bugs that might be related:

                • https://connect.microsoft.com/VisualStudio/feedback/details/800364/initializer-list-calls-object-destructor-twice
                • http://connect.microsoft.com/VisualStudio/feedback/details/800104/

                老实说,我认为这些是不同的.有谁知道

                Honestly I think these are different, though. Does anyone know

                1. 是否存在针对此连接的主动跟踪错误
                2. 是否有解决方法(或对导致此错误的情况的明确描述,以便我们可以在我们的代码库中查找/避免它)?

                <小时>

                [1] 只需使用 C++ 控制台应用程序向导"创建一个空项目.为简单起见,禁用预编译头并保留所有默认值:http://i.stack.imgur.com/rrrnV.png


                [1] Just create an empty project using the C++ Console Application 'wizard'. For simplicity, disable precompiled headers and leave all defaults: http://i.stack.imgur.com/rrrnV.png

                推荐答案

                一个活动问题已在 11 月.发布的示例代码是:

                An active issue was posted back in November. The sample code posted was:

                Compile and run following code in VS2013
                
                #include <string>
                
                void f(std::string s = {}) {
                }
                
                int main(int argc, char* argv[]) {
                    f();
                    return 0;
                }
                

                微软已确认该错误.

                那里似乎没有发布解决方法.编辑解决方法很容易基于避免列表初始化语法:

                There doesn't seem to be a work-around posted there. Edit Workarounds can easily be based on avoiding the list-initializer syntax:

                void f(std::string s = "");
                void f(std::string s = std::string());
                void f(std::string s = std::string {});
                

                或者只是老式的(如果你不介意引入重载):

                Or just the old-fashioned (if you don't mind introducing overloads):

                void f(std::string s);
                void f() { f(std::string()); }
                

                这篇关于(已知)VC12 中的编译器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:即使找到接口,CoCreateInstance 也返回 E_NOINTERFACE 下一篇:如何从根目录包含 stdafx.h?

                相关文章

                最新文章

                • <bdo id='RESEh'></bdo><ul id='RESEh'></ul>

                <small id='RESEh'></small><noframes id='RESEh'>

                1. <legend id='RESEh'><style id='RESEh'><dir id='RESEh'><q id='RESEh'></q></dir></style></legend>
                  1. <tfoot id='RESEh'></tfoot>

                    <i id='RESEh'><tr id='RESEh'><dt id='RESEh'><q id='RESEh'><span id='RESEh'><b id='RESEh'><form id='RESEh'><ins id='RESEh'></ins><ul id='RESEh'></ul><sub id='RESEh'></sub></form><legend id='RESEh'></legend><bdo id='RESEh'><pre id='RESEh'><center id='RESEh'></center></pre></bdo></b><th id='RESEh'></th></span></q></dt></tr></i><div id='RESEh'><tfoot id='RESEh'></tfoot><dl id='RESEh'><fieldset id='RESEh'></fieldset></dl></div>