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++/71141] New: [concepts] Example variadic concept code in the Concepts TS 14.1p9.4 rejected


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

            Bug ID: 71141
           Summary: [concepts] Example variadic concept code in the
                    Concepts TS 14.1p9.4 rejected
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net
                CC: andrew.n.sutton at gmail dot com, asutton at gcc dot gnu.org
  Target Milestone: ---

The following test case is taken from example code in the Concepts TS Â 14.1
p9.4.  gcc r236238 rejects this code.  I presume the code is intended to be
well-formed; if not, then the Concepts TS should be updated.

$ cat t1.cpp
template<typename... Ts> concept bool C4 = true;
template<C4 T> void f5(); 

$ g++ -c -std=c++1z -fconcepts t1.cpp
t1.cpp:2:14: error: variadic constraint introduced without â...â before â>â
token
 template<C4 T> void f5();
              ^

The example is accepted if the constrained function is re-written with a
requires clause:

$ cat t2.cpp
template<typename... Ts> concept bool C4 = true;
template<typename T> requires C4<T> void f5(); 

$ g++ -c -std=c++1z -fconcepts t2.cpp; echo $?
0

An error is similarly produced when using a variadic non-type concept:

$ cat t3.cpp
template<char... Cs> concept bool C5 = true;
template<C5 C> void f7();

$ g++ -c -std=c++1z -fconcepts t3.cpp
t3.cpp:2:14: error: variadic constraint introduced without â...â before â>â
token
 template<C5 C> void f7();
              ^

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