[Bug c++/105692] New: internal compiler error: in finish_expr_stmt, at cp/semantics.cc:872

elmar.braun at web dot de gcc-bugzilla@gcc.gnu.org
Sun May 22 17:00:50 GMT 2022


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

            Bug ID: 105692
           Summary: internal compiler error: in finish_expr_stmt, at
                    cp/semantics.cc:872
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: elmar.braun at web dot de
  Target Milestone: ---

Created attachment 53015
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53015&action=edit
output of compiling with -freport-bug

Reduced testcase:

  template <typename T>
  using lambda = decltype([] {});

  template <typename Lambda>
  void f3() {}

  template <typename T>
  void f2() {
    f3<lambda<T>>();
  }

  void f1() {
    f2<int>();
  }

Compiling this with GCC 12.1.0, using the command line "g++-12.1 -std=c++20
-Wall -Wextra bug.cpp", results in the following error message:

  bug.cpp: In instantiation of ‘void f2() [with T = int]’:
  bug.cpp:13:10:   required from here
  bug.cpp:9:3: internal compiler error: in finish_expr_stmt, at
cp/semantics.cc:872
      9 |   f3<lambda<T>>();

Exact version of GCC, system type, and options given when GCC was configured
can be found in the attached output from -freport-bug.

I was also able to reproduce the issue on godbolt.org
(https://godbolt.org/z/3344WMcWT). Clang 14 and the latest MSVC compile this
code without problems.


More information about the Gcc-bugs mailing list