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

            Bug ID: 120667
           Summary: internal compiler error: in
                    cxx_eval_constant_expression, at cp/constexpr.cc:7908
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qingren2hxb at gmail dot com
  Target Milestone: ---

Input:

int main() {
  auto result = ([&]() -> int {
    int x = 0;
    if (x == 0) {
      goto label;
    }
    return 42;
  label:
    return 24;
  }());
  return 0;
}

Output:

$ g++ -
lambda.cpp: In function 'int main()':
lambda.cpp:10:4:   in 'constexpr' expansion of '<lambda closure
object>main()::<lambda()>().main()::<lambda()>()'
lambda.cpp:10:6: internal compiler error: in cxx_eval_constant_expression, at
cp/constexpr.cc:7908
   10 |   }());
      |      ^
0x1c989f6 internal_error(char const*, ...)
        ???:0
0x75eba6 fancy_abort(char const*, int, char const*)
        ???:0
0x7b1344 maybe_constant_value(tree_node*, tree_node*, mce_value)
        ???:0
0x7cf0bb cp_fully_fold_init(tree_node*)
        ???:0
0x96577a store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x800600 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x8d6379 c_parse_file()
        ???:0
0x9c3191 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Version:
gcc-13.2.0
built from git releases/gcc-13.2.0

In constexpr.cc at line 7908, the assertion gcc_assert (cxx_dialect >= cxx23)
is present. However, when I compile with the -std=c++11 option, this ICE does
not occur.

Reply via email to