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

            Bug ID: 67775
           Summary: [concepts] bug when using variadic expansions in
                    compound requirements
           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: ---

The below code prints 0, but it should print 1.

/////////////////////////////////////////////////////////////
#include <type_traits>                                                          
#include <utility>                                                              
#include <iostream>                                                             

template <class X>                                                              
concept bool cpt_RealScalar = std::is_floating_point<X>::value;                 

namespace detail {                                                              
template <class, class> constexpr bool k_evaluator_impl = false;                

template <std::size_t... Indexes, class E>                                      
  requires requires(E e) {                                                      
    { e((Indexes, 0)...) } -> cpt_RealScalar;                                   
    // requires cpt_RealScalar<decltype(e((Indexes,0)...))>; // this version
works
  }                                                                             
constexpr bool k_evaluator_impl<std::index_sequence<Indexes...>, E> = true;     
}                                                                               

template <class X, std::size_t K> concept bool cpt_KEvaluator =                 
  detail::k_evaluator_impl<std::make_index_sequence<K>, X>;                     

int main() {                                                                    
  auto f = [](int, int, int) -> double { return 3; };                           
  std::cout << cpt_KEvaluator<decltype(f), 3> << '\n';                          
  return 0;                                                                     
} 
/////////////////////////////////////////////////////////////

Reply via email to