[LLVMbugs] [Bug 20261] New: template argument deduction preformed on non-matching overloads.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 9 12:16:31 PDT 2014


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

            Bug ID: 20261
           Summary: template argument deduction preformed on non-matching
                    overloads.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12758
  --> http://llvm.org/bugs/attachment.cgi?id=12758&action=edit
Reproducer

The following code does not compile with clang. It seems that even though the
second overload does not match the arguments template argument deduction is
performed on it causing bad_type to be instantiated.

I don't believe that is correct behavior.

This bug is currently playing havoc with std::tuples allocator_arg_t overloads.

> template <class T>
> struct never { enum { value = 0 }; };
>
> template <class T>
> struct bad_type
> {
> 	static_assert(never<T>::value, "Should not be instantiated");
> 	typedef bad_type type;
> };
>
> struct dummy_type {};
>
> struct test_t
> {
> 	// Overload #1
> 	test_t(int, int) {}
> 	
> 	// Overload #2
> 	template <class First, class = typename bad_type<First>::type>
> 	test_t(dummy_type, First) {}
> };
>
> int main() { test_t t(0, 0); }

-- 
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/20140709/4f987f8d/attachment.html>


More information about the llvm-bugs mailing list