This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/85612] New: ADL lookup with parameter pack and defaulted argument not considered ambiguous


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

            Bug ID: 85612
           Summary: ADL lookup with parameter pack and defaulted argument
                    not considered ambiguous
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

Hopefully-minimal example:

#ifdef WORKS
template <typename... T, typename R=int>
R foo(T&&...) {
    return 0;
}
#else
template <typename... T>
decltype(auto) foo(T&&...) {
    return 0;
}
#endif

namespace N { 
    struct X { };

    template <typename... T>
    void foo(T&&...) = delete;
}

int main() {
    foo(N::X{});
}

gcc accepts this program with -DWORKS, but this should be ambiguous between
::foo and N::foo. It correctly rejects without -DWORKS. clang rejects in both
cases. 

The parameter pack is significant somehow too, if the parameter list were just
T&& instead of T&&..., gcc rejects as ambiguous with -DWORKS too.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]