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

            Bug ID: 121291
           Summary: ICE in diagnose_trait_expr since
                    r16-2492-gf1872cc05b0dc5
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dhruvc at nvidia dot com
  Target Milestone: ---

Min repro:

===
template <typename a>
constexpr bool b = __is_invocable(a);

template <typename c>
class f {
    static_assert(b<c>);
};

struct d {
   private:
    int operator()();
};

f<d> e;
===

Compiled with -std=c++20, gives:

===
<source>: In instantiation of 'class f<d>':
<source>:14:6:   required from here
   14 | f<d> e;
      |      ^
<source>:6:19: error: static assertion failed
    6 |     static_assert(b<c>);
      |                   ^~~~
<source>:6:19: note: 'd' is not invocable, because
<source>:6:19: error: 'int d::operator()()' is private within this context
<source>:11:9: note: declared private here
   11 |     int operator()();
      |         ^~~~~~~~
<source>:6:19: internal compiler error: in diagnose_trait_expr, at
cp/constraint.cc:3180
    6 |     static_assert(b<c>);
      |                   ^~~~

<source>:6:19: internal compiler error: in set_diagnostic_buffer, at
diagnostic.cc:1957
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
===

The assert `gcc_assert (call == error_mark_node);` in `CPTK_IS_INVOCABLE` is
failing.

Compiler explorer: https://godbolt.org/z/1bhzzqrG6

Reply via email to