[cfe-commits] [PATCH] [C++11 Compat] Fix breaking change in C++11 pair copyctor.

Michael Spencer bigcheesegs at gmail.com
Fri Jun 8 16:13:20 PDT 2012


While this code is valid C++98, it is not valid C++11. The problem can be
reduced to:

class MDNode;

class DIType {
  operator MDNode*() const {return 0;}
};

class WeakVH {
  WeakVH(MDNode*) {}
};

int main() {
  DIType di;
  std::pair<void*, WeakVH> p(std::make_pair((void*)0, di)));
}

This was not detected by any of the bots we have because they either compile
C++98 with libstdc++ (which allows it), or C++11 with libc++ (which incorrectly
allows it). I ran into the problem when compiling with VS 2012 RC.

Thanks to Richard for explaining the issue.

- Michael Spencer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-C-11-Compat-Fix-breaking-change-in-C-11-pair-copycto.patch
Type: application/octet-stream
Size: 1934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120608/b294f798/attachment.obj>


More information about the cfe-commits mailing list