[Bug c++/81042] Too many constexpr interations on unreachable loop.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81042 Valentine changed: What|Removed |Added CC||v at vsamko dot com --- Comment #3 from Valentine --- I'm having the same problem with gcc 7.2. Clang handles this correctly. constexpr int gcc_bug() { for (unsigned int i = 0; i != 1; ++i) { continue; int q = 0; while (q == -1) {} } return 0; } int main() { constexpr int x = gcc_bug(); }
[Bug c++/81042] Too many constexpr interations on unreachable loop.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81042 Mateusz Nowotynski changed: What|Removed |Added CC||maxmati4 at gmail dot com --- Comment #2 from Mateusz Nowotynski --- I also experienced this bug on gcc (Gentoo 6.4.0 p1.0) 6.4.0 and gcc (GCC) 8.0.0 20170819 (experimental). On version 6.4 it results in never ending compilation and on 8.0 it trigers same error as @KevinCox. Whats more for me it looks like regrsion since my code compiles fine on gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 haven't tried @KevinCox version. My program triggering this error: struct Table { constexpr Table() : primes() { for(int i = 1; i < 100; ++i){ if(!primes[i]) continue; for(int j = 1; j < 100; ++j); } } bool primes[100]; }; int main(){ constexpr auto primes = Table(); }
[Bug c++/81042] Too many constexpr interations on unreachable loop.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81042 --- Comment #1 from Kevin Cox --- Also it appears the loop condition isn't properly evaluated. For example the following three examples (and any other number I tested also cause the error. while (++i == 0) {} // Unreachable while (++i == 1) {} // Unreachable while (++i == 2) {} // Unreachable However some simpler expressions don't cause the error. while (false) {} // Unreachable while (i != i) {} // Unreachable