[LLVMbugs] [Bug 17834] New: "candidate template ignored: invalid explicitly-specified argument for template parameter" involving out-of-range packages int parameters
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Nov 6 11:42:24 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=17834
Bug ID: 17834
Summary: "candidate template ignored: invalid
explicitly-specified argument for template parameter"
involving out-of-range packages int parameters
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: marc at kdab.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
This is a destilled version of https://codereview.qt-project.org/65868
#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.
--
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/20131106/e9d3c94b/attachment.html>
More information about the llvm-bugs
mailing list