[Bug c++/92918] Does not do name lookup when using from base class

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 12 09:13:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92918

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-12-12
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

struct Base03
{
    static void impl();
};

struct ThisDoesNotCompileOnGCC : Base03
{
    using Base03::impl;
    static int impl(char const *);

    template <typename T>
    auto f(const T &t) const
    -> decltype(impl(t))
    {
        return impl(t);
    }
};

ThisDoesNotCompileOnGCC t;
int i = t.f("42");


92918.cc:19:40: error: no matching function for call to
‘ThisDoesNotCompileOnGCC::f(const char [3])’
   19 | int i = ThisDoesNotCompileOnGCC::f("42");
      |                                        ^
92918.cc:12:17: note: candidate: ‘template<class T> static decltype
(Base03::impl(t)) ThisDoesNotCompileOnGCC::f(const T&)’
   12 |     static auto f(const T &t)
      |                 ^
92918.cc:12:17: note:   template argument deduction/substitution failed:
92918.cc: In substitution of ‘template<class T> static decltype
(Base03::impl(t)) ThisDoesNotCompileOnGCC::f(const T&) [with T = char [3]]’:
92918.cc:19:40:   required from here
92918.cc:13:21: error: no matching function for call to
‘ThisDoesNotCompileOnGCC::impl(const char [3])’
   13 |     -> decltype(impl(t))
      |                 ~~~~^~~
92918.cc:3:17: note: candidate: ‘static void Base03::impl()’
    3 |     static void impl();
      |                 ^~~~
92918.cc:3:17: note:   candidate expects 0 arguments, 1 provided


More information about the Gcc-bugs mailing list