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

            Bug ID: 78907
           Summary: internal compiler error segmentation fault with
                    recursive constexpr
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hr.jonas.hansen at gmail dot com
  Target Milestone: ---

I recently updated my g++ version to 6.3.0 (g++ (Homebrew GCC 6.3.0) 6.3.0),
but now i get the following error:

g++: internal compiler error: Segmentation fault: 11 (program cc1plus). 

With the previous version (I'm not completely sure but around) 5.2 everything
worked. And on of my other computers I use g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1
and that also works.

The code is:

constexpr bool checkForPrimeNumber(const int p, const int t)
{
    return p <= t or (p % t and checkForPrimeNumber(p, t + 2));
}

constexpr bool checkForPrimeNumber(const int p)
{
    return p == 2 or (p & 1 and checkForPrimeNumber(p, 3));
}

int main() 
{
    static_assert(checkForPrimeNumber(65521), "bug...");
}


I compile the code with:
g++ test.cpp -std=c++11 -fconstexpr-depth=65535

Reply via email to