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

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

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

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

        (Known) compiler bug in VC12?((已知)VC12 中的编译器错误?)

          <tbody id='rTfzk'></tbody>

        • <small id='rTfzk'></small><noframes id='rTfzk'>

          <legend id='rTfzk'><style id='rTfzk'><dir id='rTfzk'><q id='rTfzk'></q></dir></style></legend>

            • <i id='rTfzk'><tr id='rTfzk'><dt id='rTfzk'><q id='rTfzk'><span id='rTfzk'><b id='rTfzk'><form id='rTfzk'><ins id='rTfzk'></ins><ul id='rTfzk'></ul><sub id='rTfzk'></sub></form><legend id='rTfzk'></legend><bdo id='rTfzk'><pre id='rTfzk'><center id='rTfzk'></center></pre></bdo></b><th id='rTfzk'></th></span></q></dt></tr></i><div id='rTfzk'><tfoot id='rTfzk'></tfoot><dl id='rTfzk'><fieldset id='rTfzk'></fieldset></dl></div>
                <bdo id='rTfzk'></bdo><ul id='rTfzk'></ul>
                  <tfoot id='rTfzk'></tfoot>
                  本文介绍了(已知)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 中的编译器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to print vector#39;s data(如何打印矢量的数据)
                  Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                  How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                  MSVC++ warning flags(MSVC++ 警告标志)
                  How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                  stack overflow error in C++ program(C++程序中的堆栈溢出错误)
                1. <legend id='0aTri'><style id='0aTri'><dir id='0aTri'><q id='0aTri'></q></dir></style></legend>

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

                    • <small id='0aTri'></small><noframes id='0aTri'>