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

            Bug ID: 96961
           Summary: ICE default lambda as non-type template with default
                    argument
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bastien.penavayre at epitech dot eu
  Target Milestone: ---

version:

g++ (Compiler-Explorer-Build) 11.0.0 20200906 (experimental)

error:

In instantiation of 'constexpr int in_template() [with auto X = <lambda closure
object>main()::<lambda(int)>{}]':
16:25:   required from here
9:13: internal compiler error: tree check: expected function_type or
method_type, have integer_type in set_flags_from_callee, at cp/call.c:328
9 |     return X();
  |            ~^~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

code:

#include <experimental/source_location>

using sl = std::experimental::source_location;
constexpr int line(sl s = sl::current()) { return s.line(); }

template<auto X = [](int i = line()){ return i; }>
constexpr int in_template() { return X(); }

template<auto> class p;

int main() { sizeof(p<in_template()>); }

Reply via email to