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

            Bug ID: 102925
           Summary: [11.2]ICE with concept of std::convertible_to with
                    lambda in unevaluated-context
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickhuang99 at hotmail dot com
  Target Milestone: ---

The following code causes ICE in 11.2 when clang and MSVC++ all work fine.
(https://www.godbolt.org/z/eGq118ohT)
This ICE is fixed in trunk with a different issue of no matching template
declaration for template specialization. 

#include <concepts>

template<class T>
concept IsLambda=std::convertible_to<T,decltype(+[]{})>;

template<IsLambda T> 
void foo(T t){ t();}

template<>
void foo<decltype(+[]{})>(decltype(+[]{}) t){
    t();
}



<source>:10:6: error: template-id 'foo<void (*)()>' for 'void foo(void (*)())'
does not match any template declaration
   10 | void foo<decltype(+[]{})>(decltype(+[]{}) t){
      |      ^~~~~~~~~~~~~~~~~~~~
<source>:7:6: note: candidate is: 'template<class T>  requires  IsLambda<T>
void foo(T)'
    7 | void foo(T t){ t();}
      |      ^~~
Compiler returned: 1

Reply via email to