<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - "candidate template ignored: invalid explicitly-specified argument for template parameter" involving out-of-range packages int parameters"
href="http://llvm.org/bugs/show_bug.cgi?id=17834">17834</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"candidate template ignored: invalid explicitly-specified argument for template parameter" involving out-of-range packages int parameters
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>marc@kdab.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This is a destilled version of <a href="https://codereview.qt-project.org/65868">https://codereview.qt-project.org/65868</a>
#include <type_traits>
// Enum
enum MouseButton {
NoButton = 0x00000000,
LeftButton = 0x00000001,
RightButton = 0x00000002,
MidButton = 0x00000004, // ### Qt 6: remove me
MiddleButton = MidButton,
BackButton = 0x00000008,
XButton1 = BackButton,
ExtraButton1 = XButton1,
ForwardButton = 0x00000010,
XButton2 = ForwardButton,
ExtraButton2 = ForwardButton,
TaskButton = 0x00000020,
ExtraButton3 = TaskButton,
ExtraButton4 = 0x00000040,
ExtraButton5 = 0x00000080,
ExtraButton6 = 0x00000100,
ExtraButton7 = 0x00000200,
ExtraButton8 = 0x00000400,
ExtraButton9 = 0x00000800,
ExtraButton10 = 0x00001000,
ExtraButton11 = 0x00002000,
ExtraButton12 = 0x00004000,
ExtraButton13 = 0x00008000,
ExtraButton14 = 0x00010000,
ExtraButton15 = 0x00020000,
ExtraButton16 = 0x00040000,
ExtraButton17 = 0x00080000,
ExtraButton18 = 0x00100000,
ExtraButton19 = 0x00200000,
ExtraButton20 = 0x00400000,
ExtraButton21 = 0x00800000,
ExtraButton22 = 0x01000000,
ExtraButton23 = 0x02000000,
ExtraButton24 = 0x04000000,
AllButtons = 0x07ffffff,
MaxMouseButton = ExtraButton24,
MouseButtonMask = 0xffffffff
};
static_assert(!std::is_signed<MouseButton>::value, "Enum should be unsigned");
// MouseButtons code
struct Int {
int i;
constexpr Int(int i) : i(i) {}
constexpr operator int() const { return i; }
};
struct MouseButtons {
unsigned int i;
constexpr MouseButtons(MouseButton e) : i(e) {}
constexpr MouseButtons(Int i) : i(i) {}
constexpr operator unsigned int() const { return i; }
};
constexpr MouseButtons operator~(MouseButtons i) { return Int(~i.i); }
// test code
template <unsigned int N, typename T> bool f(T n) { return n == N; }
int main() {
f< MouseButtons(LeftButton)>( LeftButton); // OK
f<~MouseButtons(LeftButton)>(~LeftButton); // ERROR: invalid
explicitly-specified argument for template parameter 'T'
}
Expected error: "candidate template ignored: narrowing conversion from X to Y
for template argument 'N'.
Note in particular how the current message picks the _wrong template argument_
to complain about.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>