[llvm-bugs] [Bug 39581] New: base class template methods are not included in derived object method name resolution

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 7 08:23:14 PST 2018


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

            Bug ID: 39581
           Summary: base class template methods are not included in
                    derived object method name resolution
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wl at gnu.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The following MWEs both compile with g++ but not with clang.  This seems to be
a bug.

type parameters
---------------

struct Base {
 template <class T>
 void tmpl_method () { }
};

struct Derived : public Base {
 using Base::tmpl_method;

 template <class T, class X>
 void tmpl_method () { }
};

void foo () {
 Derived bar;
 bar.tmpl_method<int>();
}

(cf. https://godbolt.org/z/WpET78)

-> <source>:15:6: error:
       no matching member function for call to 'tmpl_method'
    bar.tmpl_method<int>();
    ~~~~^~~~~~~~~~~~~~~~
   <source>:10:7: note:
       candidate template ignored:
       couldn't infer template argument 'X'
    void tmpl_method () { }
      ^

non-type parameters
-------------------

(cf. https://godbolt.org/z/PZIaDn)

struct Base {
 template <int I>
 void tmpl_method () { }
};

struct Derived : public Base {
 using Base::tmpl_method;

 template <bool B>
 void tmpl_method () { }
};

void foo () {
 Derived bar;
 bar.tmpl_method<5>();
}

-> <source>:15:6: error:
       no matching member function for call to 'tmpl_method'
    bar.tmpl_method<5>();
    ~~~~^~~~~~~~~~~~~~

   <source>:10:7: note: candidate template ignored:
       invalid explicitly-specified argument for
       template parameter 'B'
    void tmpl_method () { }
         ^

The issue was discussed in a thread on the cfe-users mailing list starting with

  http://lists.llvm.org/pipermail/cfe-users/2018-November/001417.html

-- 
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/20181107/818c3b6d/attachment.html>


More information about the llvm-bugs mailing list