[llvm-bugs] [Bug 28195] New: Clang allows ambiguous derived-to-base pointer conversion.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 19 15:11:41 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28195

            Bug ID: 28195
           Summary: Clang allows ambiguous derived-to-base pointer
                    conversion.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

For example:

#include <cassert>

template <int N> struct Base { };
struct Der : Base<1>, Base<2> {};

template <int N> bool found_base(const Base<N>*)  { return true; }
bool                  found_base(...)             { return false; }

int main() { const Der d; assert(found_base(&d) == false); }

In the above example Clang selects the conversion to const Base<2>*.

-- 
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/20160619/488ee04b/attachment.html>


More information about the llvm-bugs mailing list