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++/84421] New: [8 Regression] Lambda parameter is no longer a core constant expressions


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

            Bug ID: 84421
           Summary: [8 Regression] Lambda parameter is no longer a core
                    constant expressions
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benni.buch at gmail dot com
  Target Milestone: ---

struct A{
        constexpr operator bool()const{ return true; }
};

int main(){
    auto f = [](auto v){ if constexpr(v){} };
    A a;
    f(a);
}


$ g++ -std=c++17 main.cpp
main.cpp: In lambda function:
main.cpp:6:40: error: 'v' is not a constant expression
     auto f = [](auto v){ if constexpr(v){} };
                                        ^
$ g++ --version
g++ (GCC) 8.0.1 20180216 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Known to work with GCC-7:

$ g++-7 --version
g++ (GCC) 7.3.1 20180216
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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