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

            Bug ID: 67331
           Summary: ICE with recursive variable template with non-type
                    template parameters
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: morwenn29 at hotmail dot fr
  Target Milestone: ---

I tried to write a recursive variable template with non-type template
parameters (booleans in my case) and got an internal compiler error. Here is a
minimal failing example:

template<bool Head, bool... Tail>
constexpr bool any = Head || any<Tail...>;

template<bool Head>
constexpr bool any<Head> = Head;

int main()
{
    static_assert(any<false, false, true, false>, "");
}


And here is the error message I get:

main.cpp:2:16: internal compiler error: Segmentation fault

 constexpr bool any = Head || any<Tail...>;


It also fails if I remove the terminal case or if I change bool to another
non-type template parameter. It only fails when the variable template
definition is recursive.

Reply via email to