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

            Bug ID: 67655
           Summary: [concepts] expression constraints and variadic
                    expansions
           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: ---

I expect the following should be valid code:

####### BEGIN 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) {                                                               
  }                                                                             
  A(int) {}                                                                     
};                                                                              

int main() {                                                                    
  A<int, double> a(55);                                                         
  return 0;                                                                     
} 
####### END CODE ########

with the first first of the constructor being disabled and the second matching.
But this gives the compilation error:

t2.cpp: In instantiation of ‘struct A<int, double>’:
t2.cpp:16:19:   required from here
t2.cpp:8:14: error: mismatched argument pack lengths while expanding ‘Xs{ys}’
       consume(Xs{ys}...);

Looking through N4377, I'm not entirely sure how this should be treated, but
would think it should just mean that the expression constraint
consume(Xs{ys}...) shouldn't be satisfied instead of triggering a hard error.

Reply via email to