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++/66841] New: [concepts] bogus error "invalid reference to function concept" when function concept is overloaded


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

            Bug ID: 66841
           Summary: [concepts] bogus error "invalid reference to function
                    concept" when function concept is overloaded
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

This is related to the discussion in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66834. Because of the kind
mismatch error described in 66834, the straightforward implementation of
Constructible doesn't work, and the concept must be overloaded. But once it's
overloaded, uses of it cause of "invalid reference to function concept" error.


template <class T, class U>
concept bool Same =
  __is_same_as(T, U);

template <class T, class U>
concept bool ExplicitlyConvertible() { return
  Same<T, U> ||
  requires(T&& t) {
    static_cast<U>((T&&)t);
  };
}

template <class T>
concept bool Constructible() { return
  requires {
    T{ };
  };
}

template <class T, class U>
concept bool Constructible() { return
  ExplicitlyConvertible<U, T>() ||
  requires (U&& u) {
    T{ (U&&)u };
  };
}

template <class T, class U, class V, class...Args>
concept bool Constructible() { return
  requires (U&& u, V&& v, Args&&...args) {
    T{ (U&&)u, (V&&)v, (Args&&)args... };
  };
}

template <class, class...>
constexpr bool core_constructible() { return false; }

template <class T, class...Args>
  requires Constructible<T, Args...>() // ERROR HERE
constexpr bool core_constructible() { return false; }


Yields:

../cmcstl2/scratch/constructible.cpp:40:23: error: invalid reference to
function concept âtemplate<class T, class U, class V, class ... Args> constexpr
bool Constructible()â
 requires Constructible<T, Args...>()
                       ^

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