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

            Bug ID: 67656
           Summary: [concepts] matched variadics in expression constraint
                    report as unmatched
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

In this code

/////////////////////////////////
template<class... Xs>                                                           
void consume(Xs&&...) {}                                                        

template<class... Xs>                                                           
struct A {                                                                      
  template<class... Ys>                                                         
    requires requires(Ys... ys) {                                               
      consume(Xs{ys}...);                                                       
    }                                                                           
  A(Ys&&... ys) {                                                               
  }                                                                             
};                                                                              

int main() {                                                                    
  A<int, long> a(55, 2);                                                        
  return 0;                                                                     
} 
/////////////////////////////////

"consume(Xs{ys}...)" is a valid expression so the constructor should be called,
but gcc gives a mismatched pack lengths error.

######### Error ##########
t2.cpp: In instantiation of ‘struct A<int, long int>’:
t2.cpp:15:17:   required from here
t2.cpp:8:14: error: mismatched argument pack lengths while expanding ‘Xs{ys}’
       consume(Xs{ys}...);
              ^
t2.cpp: In function ‘int main()’:
t2.cpp:15:23: error: no matching function for call to ‘A<int, long int>::A(int,
int)’
   A<int, long> a(55, 2);
                       ^
t2.cpp:10:3: note: candidate: A<Xs>::A(Ys&& ...) [with Ys = {int, int}; Xs =
{int, long int}]
   A(Ys&&... ys) {
   ^
t2.cpp:10:3: note:   constraints not satisfied
t2.cpp:5:8: note: candidate: constexpr A<int, long int>::A(const A<int, long
int>&)
 struct A {
        ^
t2.cpp:5:8: note:   candidate expects 1 argument, 2 provided
t2.cpp:5:8: note: candidate: constexpr A<int, long int>::A(A<int, long int>&&)
t2.cpp:5:8: note:   candidate expects 1 argument, 2 provided

Reply via email to