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

            Bug ID: 86375
           Summary: Lambda call in template parameter causes compile time
                    error
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Following example fail to compile:

template <int I> struct stuff {};
stuff< [](){ return 42; }() > a; // Calling a constexpr lambda


Error message: 

lambda-expression in template-argument
 stuff< [](){ return 42; }() > a;


Replacing the lambda with variable that holds lambda works well:

template <int I> struct stuff {};
auto f = [](){ return 42; };
stuff< f() > b; // OK

Clang compiles the first example well.

Reply via email to