http://llvm.org/bugs/show_bug.cgi?id=18792
Bug ID: 18792
Summary: Note in wrong place when using std::enable_if_t
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++1y
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Consider the following code (enable_if_t is part of C++1y):
template <bool>
struct enable_if { };
template <>
struct enable_if<true> { using type = void; };
template <bool C>
using enable_if_t = typename enable_if<C>::type;
template <typename T, enable_if_t<sizeof(T) == 0>* = nullptr>
//template <typename T, typename enable_if<sizeof(T) == 0>::type* = nullptr>
static void foo()
{
}
int main()
{
foo<int>();
}
Compiled with clang r201068 this results in:
% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:18:3: error: no matching function for call to 'foo'
foo<int>();
^~~~~~~~
clang.cpp:8:40: note: candidate template ignored: disabled by 'enable_if' [with
T = int]
using enable_if_t = typename enable_if<C>::type;
^
1 error generated.
While the error is correct, the note is at the wrong place. It should be at
<foo>, not <enable_if_t>, as is the case when enable_if is used directly (see
the commented line):
% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:18:3: error: no matching function for call to 'foo'
foo<int>();
^~~~~~~~
clang.cpp:11:42: note: candidate template ignored: disabled by 'enable_if'
[with T = int]
template <typename T, typename enable_if<sizeof(T) == 0>::type* = nullptr>
^
1 error generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs