[LLVMbugs] [Bug 21574] New: std::is_constructible for scalar types only allows implicit conversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 14 08:24:18 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21574

            Bug ID: 21574
           Summary: std::is_constructible for scalar types only allows
                    implicit conversion
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sebastian at theophil.net
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 13349
  --> http://llvm.org/bugs/attachment.cgi?id=13349&action=edit
Reproduction of bug

When T is a scalar type, the library implementation of std::is_constructible<T,
Arg> returns true iff Arg is implicitly convertible to T. 

However, the C++11 standard section  20.9.4.3 says: 

> Given the following function prototype:
> 
> template <class T>
> typename add_rvalue_reference<T>::type create();
> 
> the predicate condition for a template specialization is_constructible<T, Args...> shall be satisfied if and only if the following variable definition would be well-formed for some invented variable t:
> 
> T t(create<Args>()...);

To reproduce, compile attached file with "c++ -std=c++11 multiprecision.cpp"
using clang version <= 3.4 or clang shipping with Xcode 6.1

The static_assert fails but the explicit construction does not. 

I've tried clang 3.5 at http://melpon.org/wandbox and the static_assert does
not fail anymore. BUT, from looking at
http://llvm.org/svn/llvm-project/libcxx/trunk/include/type_traits it seems that
libcxx now checks for the compiler feature "is_constructible" and uses that if
available, which apparently produces the expected result. 

The manual implementation below still contains the same error from what I can
see.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141114/38a054d2/attachment.html>


More information about the llvm-bugs mailing list