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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to