Visual C ++编译器错误?

问题描述

我在下面尽可能减少了案情。

#include <vector>
#include <atomic>
#include <chrono>

using namespace std;

class Unused
{
  private:

    vector<vector<unsigned>> data;
    atomic<unsigned> counter;
};

class Timer
{
  private:

    chrono::time_point<chrono::high_resolution_clock> begin;

  public:

    void start()
    {
      begin = std::chrono::high_resolution_clock::now();
    }

};

int main()
{
  Unused unused;

  vector<Timer> timers;
  timers.resize(1);
  timers[0].start();
}

我将其编译为(请注意特定标志):

cl /O2 /GL /EHsc driver.cpp

这是

Microsoft (R) C/C++-Optimierungscompiler Version 19.27.29111 für x86
Microsoft (R) Incremental Linker Version 14.27.29111.0

但是我也尝试了其他几个最新版本。可执行文件段出现内存访问冲突。它适用于g ++,如果我更改了编译标志,它也适用。如果我进一步简化代码,它也可以工作。

这是编译器错误吗?

解决方法

这确实是一个编译器错误https://developercommunity.visualstudio.com/content/problem/1157189/possible-compiler-bug-1.html

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...