Variadic concepts as non-pack constrained template parameter specifiers

82 views
Skip to first unread message

Tom Honermann

unread,
Mar 17, 2016, 11:03:18 PM3/17/16
to conc...@isocpp.org
While browsing the Concepts TS, I discovered that one of the examples in
§ 14.1 p(9.4) fails to compile with gcc and I'm not sure if it is an
issue with the compiler or with the TS.

Using just the relevant lines from the example:

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

$ g++ -c -std=c++1z t.cpp
t.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 t2.cpp
<no error>

An error is similarly produced when using a variadic non-type concept as
a non-pack template parameter:

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

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

I'm using gcc r232017 (From 2015-12-31, I'm due for an upgrade).

Tom.

Tom Honermann

unread,
May 16, 2016, 12:26:21 AM5/16/16
to conc...@isocpp.org
I went ahead and filed a bug against gcc for this:
- Bug 71141 - [concepts] Example variadic concept code in the Concepts TS 14.1p9.4 rejected
- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71141

If it is decided that this code is well-formed, then I think the declaration of f7() in t3.cpp should be added to the example in the Concepts TS.

Tom.
Reply all
Reply to author
Forward
0 new messages