[Bug c++/77595] New: concepts: constrained member functions illegally instantiated during explicit class template instantiation
akrzemi1 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 15 07:27:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77595
Bug ID: 77595
Summary: concepts: constrained member functions illegally
instantiated during explicit class template
instantiation
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: akrzemi1 at gmail dot com
Target Milestone: ---
The following correct program, compiled with -fconcepts, gives compilation
errors:
```
#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
below."
More information about the Gcc-bugs
mailing list