[Bug c++/79686] New: Variadic template expansion into concept with leading parameters

anthony.ajw at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 23 10:04:00 GMT 2017


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

            Bug ID: 79686
           Summary: Variadic template expansion into concept with leading
                    parameters
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anthony.ajw at gmail dot com
  Target Milestone: ---

If I declare a concept that takes a fixed argument and then a variadic
argument, I cannot use it in a function that passes a variadic parameter pack
to the concept. The following code fails to compile:

template<typename T,typename ... U>
concept bool X=true;

template<typename ... Args>
void foo(Args&& ...) requires X<Args...>{}

int main(){
    foo(3);
}

Output of g++ -fconcepts t.cpp

t.cpp:5:31: error: invalid reference to concept ‘X<Args ...>’
 void foo(Args&& ...) requires X<Args...>{}
                               ^~~~~~~~~~
t.cpp: In function ‘int main()’:
t.cpp:8:10: error: cannot call function ‘void foo(Args&& ...) requires 
<erroneous-expression> [with Args = {int}]’
     foo(3);
          ^
t.cpp:5:6: note:   constraints not satisfied
 void foo(Args&& ...) requires X<Args...>{}
      ^~~
t.cpp:8:10: note: ill-formed constraint
     foo(3);
          ^

g++ --version
g++ (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901

I get the same errors from my build of gcc 7:

g++-7 --version
g++-7 (GCC) 7.0.0 20170115 (experimental)


More information about the Gcc-bugs mailing list