[LLVMbugs] [Bug 18834] New: Ambiguity isn't caught when a derived class is passed to a function template taking a `simple-template-id`

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 14 02:10:48 PST 2014


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

            Bug ID: 18834
           Summary: Ambiguity isn't caught when a derived class is passed
                    to a function template taking a `simple-template-id`
           Product: clang
           Version: 3.4
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: filip.roseen at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

template<typename>
struct Base { };

struct Derived : Base<void>, Base<void*> { };

template<template<typename> class TT, typename T>
void func (TT<T>) { } 

int main () {
  func (Derived { }); 
}

- - - - - - - - - - - - - - - - - - - - - - - - - -

[temp.deduct.call]/5 says that if an ambigiuity is found when trying to deduce
template type parameters the code is illformed and type deduction fails.

clang incorrectly accepts the provided snippet, even though `func<Base,void>`
and `func<Base,void*>` are equally possible alternatives.

Currently `func (Derived { })` will be called with `TT = Base, T = void*` (ie.
the last matching base).

-- 
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/20140214/e5d00708/attachment.html>


More information about the llvm-bugs mailing list