[LLVMbugs] [Bug 24258] New: convert type trait errors to english

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 15:14:49 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24258

            Bug ID: 24258
           Summary: convert type trait errors to english
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The standard defines a pile of type traits like "is_convertible" (also,
"is_same", "is_base_of", "is_bind_expression", "is_placeholder", "is_void",
"is_constructable", ...) and we currently don't issue the best errors for
these.

$ cat b16776752-2.cc
#include <type_traits>
using namespace std;

struct X {};
struct Y {};

template<class U1, class U2,
         class = typename enable_if<is_convertible<U1, U2>::value>::type>
constexpr void f();

void test() {
  f<X, Y>();
}
$ clang++ -std=c++14 b16776752-2.cc
b16776752-2.cc:12:3: error: no matching function for call to 'f'
  f<X, Y>();
  ^~~~~~~
b16776752-2.cc:8:37: note: candidate template ignored: disabled by 'enable_if'
      [with U1 = X, U2 = Y]
         class = typename enable_if<is_convertible<U1, U2>::value>::type>
                                    ^
1 error generated.

We should instead issue a note that "U1 is not convertible to U2" (given that
this is also a context where the is_convertible must resolve to true).

-- 
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/20150724/7b2daf0b/attachment.html>


More information about the llvm-bugs mailing list