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

            Bug ID: 66937
           Summary: Do not compare constraints for unconstrained template
                    template parameters
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rbock at eudoxos dot de
                CC: andrew.n.sutton at gmail dot com
  Target Milestone: ---

Created attachment 36014
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36014&action=edit
copy tuple args implementation and test code that currently fails to compile

I have a template that takes a std::tuple (source) and copies its arguments
into another template (sink), see attached code.

template<typename Tuple, template<typename...> class Sink>
using copy_tuple_args = ...

The copy_tuple_args template is supposed to be generic, not caring about the
nature of the copied arguments or the sink. This works fine as long as the sink
is not constrained, e.g. if the sink is another tuple. But if the sink has
constraints,

template<Column... C>
struct column_list;

then both N4377 and the current gcc concepts implementation (revision 225987)
do not allow copying, because the argument (column_list) is more constrained
than the unconstrained parameter (Sink).

This seems to be a rather unfortunate rule. I believe that copy_tuple_args is a
reasonable use case (which works just fine with C++11). It will stop working as
soon as concepts start to get used.

In private communication Andrew Sutton agreed that this is an issue. I am going
to file a defect report for the Concepts TS. Andrew intends to discuss this in
Kona.

Andrew's proposed solution is to not compare constraints for unconstrained
template template parameters. This will certainly fix the problem for me :-)

Best,

Roland

Reply via email to