https://llvm.org/bugs/show_bug.cgi?id=30357
Bug ID: 30357 Summary: Unexpected compile time error with vector<bool> Product: libc++ Version: 3.8 Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedclangb...@nondot.org Reporter: billy.jasinie...@hpe.com CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified An test case (that is an excerpt from a standard validation test) gets an error when compiled with both g++ and clang, but only with headers from libc++. When the same test case is compiled using gnu headers, the test compiles cleanly. The test case: #include <vector> struct alloc : std::allocator<bool> {}; int main(void) { std::vector<bool> v1; std::vector<bool, alloc>::reference r01 = v1[0]; } With clang: $ clang -c t.cpp -std=c++11 -Ic:/downloads/libcxx-3.8.1.src/include t265.cpp:6:45: error: no viable conversion from '__bit_reference<vector<[...], std::__1::allocator<bool>>>' to '__bit_reference<vector<[...], alloc>>' std::vector<bool, alloc>::reference r01 = v1[0]; ^ ~~~~~ c:/downloads/libcxx-3.8.1.src/include/__bit_reference:35:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'reference' (aka '__bit_reference<std::__1::vector<bool, std::__1::allocator<bool> > >') to 'const std::__1::__bit_reference<std::__1::vector<bool, alloc>, true> &' for 1st argument class __bit_reference ^ c:/downloads/libcxx-3.8.1.src/include/__bit_reference:51:31: note: candidate function _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT ^ 1 error generated. With g++: $ g++ -c t.cpp -std=c++11 -Ic:/downloads/libcxx-3.8.1.src/include t265.cpp: In function ‘int main()’: t265.cpp:6:55: error: conversion from ‘std::__1::vector<bool>::reference {aka std::__1::__bit_reference<std::__1::vector<bool>, true>}’ to non-scalar type ‘std::__1::vector<bool, alloc>::reference {aka std::__1::__bit_reference<std::__1::vector<bool, alloc>, true>}’ requested std::vector<bool, alloc>::reference r01 = v1[0]; The test case also compiles cleanly when headers from Dinkumware are used. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs