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

            Bug ID: 92652
           Summary: function call to lambda expression that return true
                    does not satisfy the constraint in requires-clause
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boostcpp at gmail dot com
  Target Milestone: ---

Following code has unsatisfied constraint with error messages 

prog.cc:15:25: error: could not convert 'true' from 'bool' to 'auto'
prog.cc: In lambda function:
prog.cc:15:25: error: invalid use of 'auto'

template < typename T >
    requires ([]{return true ;}())
void h() { }

int main()
{
    h() ; // unsatisfied constraint
}

if require-clause is like: requires(yes()), with the yes was defined like this.

constexpr auto yes(){ return true ; }

It satisfy the constraint.

As well as : requires( []()->bool{return true; }() ) 

but requires( []{return true;}() ) does not satisfy the constraint which I
believe it satisfy the constraint.



The entire code example.

https://wandbox.org/permlink/tlkVJFEp3LbSWqhf

Reply via email to