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++/85200] [8 Regression] ICE in constexpr-if in lambda in template


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

Benjamin Buch <benni.buch at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #5 from Benjamin Buch <benni.buch at gmail dot com> ---
First test case still fails with a wrong error message and an ICE:

struct A{
    constexpr operator int(){ return 0; }
};

template < typename >
void f(){
    [](auto known){
        if constexpr(constexpr int k = known);
    }(A{});
}

int main(){
    f<int>();
}


$ g++ -std=c++17 main.cpp                                                       
main.cpp: In lambda function:
main.cpp:7:18: error: Local declaration from a different function
     [](auto known){
                  ^
k                                                                               
main.cpp:8:36: note: in statement
         if constexpr(constexpr int k = known);
                                    ^
k = 0;                                                                          
during GIMPLE pass: cfg                                                         
main.cpp:7:18: internal compiler error: verify_gimple failed
     [](auto known){
                  ^
0xed1883 verify_gimple_in_cfg(function*, bool)                                  
        ../../gcc/gcc/tree-cfg.c:5585                                           
0xdb891f execute_function_todo                                                  
        ../../gcc/gcc/passes.c:1994                                             
0xdb986e execute_todo                                                           
        ../../gcc/gcc/passes.c:2048
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ g++ --version
g++ (GCC) 8.0.1 20180405 (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.


GCC 7 and clang 8 are accepting the code.

I'm not sure what the error message means, but I'm quite sure it isn't correct
here.

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