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

            Bug ID: 119668
           Summary: C++20 Nested concepts with NTTP triggers ICE
           Product: gcc
           Version: 13.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nlebedenko at hotmail dot com
  Target Milestone: ---

The following snippet triggers an ICE in GCC 13.3, and GCC 12.4, 11.4, 10.5. It
does not appear in GCC 14.1+.
See it on godbolt: https://godbolt.org/z/3GzTezb7o


```cpp
// playground.cpp
struct Struct0 {};

struct Struct1 {
      Struct0 s0;
};

template <Struct1 s1_>
struct Struct2 {
      constexpr static Struct1 s1 = s1_;
};

template <Struct0 s0>
concept c0 = true; // can put any condition here

template <Struct1 s1>
concept c1 = c0<s1.s0>;

template <typename S2>
// concept c2 = bool(c1<S2::s1>); // works
concept c2 = c1<S2::s1>; // uh oh!

static_assert(c2<Struct2<Struct1{Struct0{}}>>);
```

Console printout (GCC 13.3):
```
# gcc -std=c++20 -freport-bug playground.cpp
playground.cpp:22:47: internal compiler error: in lvalue_kind, at
cp/tree.cc:223
   22 | static_assert(c2<Struct2<Struct1{Struct0{}}>>);
      |                                               ^
0x1153292 internal_error(char const*, ...)
        ???:0
0x1147921 fancy_abort(char const*, int, char const*)
        ???:0
0x1347298 lvalue_kind(tree_node const*)
        ???:0
0x13472c2 lvalue_kind(tree_node const*)
        ???:0
0x1439bff coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
        ???:0
0xbe96be evaluate_concept_check(tree_node*)
        ???:0
0x13594fa maybe_constant_value(tree_node*, tree_node*, mce_value)
        ???:0
0x184e6f7 finish_static_assert(tree_node*, tree_node*, unsigned int, bool,
bool)
        ???:0
0x17c8209 c_parse_file()
        ???:0
0x17ae67c c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-13/README.Bugs> for instructions.

Reply via email to