简体   繁体   English

std :: make_pair C ++ 11 + VS2013 =编译器错误

[英]std::make_pair C++11 + VS2013=compiler error

I have such codee: 我有这样的编码:

struct Foo {
  unsigned attr : 7;

  std::pair<char *, unsigned> f() {
      char *ch = nullptr;
      return std::make_pair(ch, static_cast<unsigned>(attr));
  }
};

MSVS2013 give me something like this error: MSVS2013给我这样的错误:

can not convert 'unsigned int' to 'unsigned int&' 无法将“ unsigned int”转换为“ unsigned int&”

While gcc 4.8 and clang 3.3 compile such code without errors. 而gcc 4.8和clang 3.3编译这些代码时不会出错。

Is this MSVS compiler bug? 这是MSVS编译器错误吗? If so, where I should report it? 如果是这样,我应该在哪里报告?

Compiles and works just fine in VS2010. 编译并在VS2010中正常工作。 Must be a bug. 必须是一个错误。 Report it to Microsoft Connect: https://connect.microsoft.com/VisualStudio 将其报告给Microsoft Connect: https : //connect.microsoft.com/VisualStudio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM