[llvm-bugs] [Bug 41309] member functions shadow template arguments resulting in "reference to non-static member function must be called" error

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 26 14:03:58 PDT 2020


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Fixed By Commit(s)|                            |d1446017f3fdc2f6a9efba22200
                   |                            |8d20afa1e26cc
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Richard Smith <richard-llvm at metafoo.co.uk> ---
> Moreover, in CWG458, where the special handling of template members of class
> templates was added to [temp.local]p7, there is similar code:
[...]
> And CWG think that it should be ill-formed:

CWG recently discussed this again, and decided that the rule in the standard is
correct as-is (reversing the decision from March 2004). Each template parameter
scope is associated with some enclosing lexical scope, and the template
parameters are searched after that enclosing lexical scope is searched. For
example, in:

template<typename> struct A {
  template<typename> struct B {
    template<typename> void f();
  };
};

template<typename T> template<typename U> template<typename V> void
A<T>::B<U>::f() {
  // #1
}

a lookup from #1 will consider V, then B<U> (and non-dependent base classes),
then U, then A<T> (and non-dependent base classes), then T, then the global
namespace scope.

The rules in this area will be clarified by the upcoming P1787.

I recently implemented that (longstanding but not previously implemented by any
compiler) rule in d1446017f3fdc2f6a9efba222008d20afa1e26cc.

-- 
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/20200626/988ff2bb/attachment.html>


More information about the llvm-bugs mailing list