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

            Bug ID: 71225
           Summary: [7 Regression] Overeager instantiation of members of
                    non-template class nested in class template
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

Created attachment 38540
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38540&action=edit
Repro

r236559 fails to compile this TU:

namespace std {
    template <bool, class> struct enable_if;
}

template <class T>
struct BidirectionalRange;

template<typename Rng>
struct stride_view
{
    struct adaptor
    {
        template<int _c_11 = 42, typename std::enable_if<
            _c_11 == 43 || BidirectionalRange<Rng>(), int>::type = 0>
        void clean() const
        {}
        template<int _c_14 = 42, typename std::enable_if<
            _c_14 == 43 || !BidirectionalRange<Rng>(), int>::type = 0>
        void clean() const
        {}
        void advance()
        {
            clean();
        }
    };
};

with diagnostics:

$ ~/gcc-r236559/bin/g++ repro2.cpp -c
repro2.cpp: In member function ‘void stride_view<Rng>::adaptor::advance()’:
repro2.cpp:23:19: error: call of overloaded ‘clean()’ is ambiguous
             clean();
                   ^
repro2.cpp:15:14: note: candidate: void stride_view<Rng>::adaptor::clean()
const [with int _c_11 = 42; typename std::enable_if<((_c_11 == 43) ||
BidirectionalRange<Rng>()), int>::type <anonymous> = 0; Rng = Rng]
         void clean() const
              ^~~~~
repro2.cpp:19:14: note: candidate: void stride_view<Rng>::adaptor::clean()
const [with int _c_14 = 42; typename std::enable_if<((_c_14 == 43) || (!
BidirectionalRange<Rng>())), int>::type <anonymous> = 0; Rng = Rng]
         void clean() const
              ^~~~~

This is a regression from the behavior of about a week ago.

Reply via email to