[LLVMbugs] [Bug 20498] New: Hidden function overloading

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 30 16:54:23 PDT 2014


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

            Bug ID: 20498
           Summary: Hidden function overloading
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Functions in a derived class which would otherwise be found by overload
resolution should be warned on at the call site. Eg)

(from test/SemaCXX/warn-overload-virtual.cpp)

namespace {
struct base {
  void f(char) {}
};

struct derived : base {
  void f(int) {}
};

void foo(derived &d) {
  d.f('1'); // FIXME: this should warn about calling (anonymous
namespace)::derived::f(int)
            // instead of (anonymous namespace)::base::f(char).
            // Note: this should be under a new diagnostic flag and eventually
moved to a
            // new test case since it's not strictly related to virtual
functions.
  d.f(12);  // This should not warn.
}
}

Since d.f('1') would call base::f(char) were it not hidden by derived::f(int),
that call should result in a warning and ideally a fix-it.

Note that this is not the property of the declaration so much as a property of
the call site.

-- 
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/20140730/addbe89e/attachment.html>


More information about the llvm-bugs mailing list