This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82022] New: constexpr lambda in template context: expression ‘<lambda>’ is not a constant expression


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

            Bug ID: 82022
           Summary: constexpr lambda in template context: expression
                    ‘<lambda>’ is not a constant expression
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bastien.penavayre at epitech dot eu
  Target Milestone: ---

Created attachment 42073
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42073&action=edit
source code

in a template context a constexpr lambda doesn't seem to be able to be
constexpr evaluated and its result is not constexpr.

if constexpr ([]() constexpr {return true;}()); //expression ‘<lambda>’ is not
a constant expression

constexpr bool r = []() constexpr {return true;}();
if constexpr (r); //"r" used in its own initializer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]