Bug 87478 - [DR 1980] Hidden member function falsely takes part in qualified name lookup
Summary: [DR 1980] Hidden member function falsely takes part in qualified name lookup
Status: SUSPENDED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks: c++-core-issues
  Show dependency treegraph
 
Reported: 2018-10-01 12:44 UTC by Mario Bielert
Modified: 2021-09-17 04:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-09-16 00:00:00


Attachments
Example code, which should be rejected (268 bytes, text/x-csrc)
2018-10-01 12:44 UTC, Mario Bielert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Bielert 2018-10-01 12:44:55 UTC
Created attachment 44772 [details]
Example code, which should be rejected

In the attached example, a base class is defined with a member function template and a derived class is defined with the same member function template. Both member function templates have the same parameter list but are SFINAE'd with exclusive conditions.

However, according to http://eel.is/c++draft/namespace.udecl#1 hidden functions shall not participate in the name lookup and the base function template is hidden according to http://eel.is/c++draft/namespace.udecl#15. Therefore, the example code should be rejected, but it compiles without warnings.

The issue came up on this stackoverflow question: https://stackoverflow.com/questions/52590220/name-lookup-error-of-enable-ifd-inherited-member-functions
Comment 1 Jonathan Wakely 2018-10-01 13:30:55 UTC
Confirmed, not a regression. Reduced:

template<typename> struct is_int { };
template<> struct is_int<int> { using type = void; };

class MyTag {};

template<typename> struct is_tag { };
template<> struct is_tag<MyTag> { using type = void; };

struct Base
{
    template <typename RType>
    typename is_int<RType>::type create(RType)
    {
    }
};

struct Derived : Base
{
    using Base::create;

    template <typename Tag>
    typename is_tag<Tag>::type create(Tag)
    {
    }
};

int main()
{
    Derived d;

    d.create(MyTag());
    d.create(0);
}
Comment 2 Olivier Kannengieser 2018-10-01 18:19:44 UTC
Is this realy a bug or an other instance of core issue 1980: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1980.

I think the behavior of Gcc is the one expected by the standardization commitee.
Comment 3 Jonathan Wakely 2018-10-03 10:23:00 UTC
Yes, it's that issue again, thanks.