Bug ID: 77595
           Summary: concepts: constrained member functions illegally
                    instantiated during explicit class template
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot
          Reporter: akrzemi1 at gmail dot com
  Target Milestone: ---

The following correct program, compiled with -fconcepts, gives compilation

#include <memory>
#include <type_traits>

template <typename T>
struct Wrapper
    T val;

    explicit Wrapper(T && v)
      : val(std::move(v)) {}

    explicit Wrapper(T const & v)
      requires std::is_copy_constructible<T>::value
      : val(v) {}

template struct Wrapper<std::unique_ptr<int>>;

int main() {}

According to p0121r0, 14.8.2 [temp.explicit]:

"An explicit instantiation that names a class template specialization is also
an explicit instantiation of the same kind (declaration or definition) of each
of its members (not including members inherited from base classes and members
that are templates) that has not been previously explicitly specialized in the
translation unit containing the explicit instantiation, and provided that
the associated constraints, if any, of that member are satisfied by the
template arguments of the explicit instantiation (14.10.2), except as described

Reply via email to