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

            Bug ID: 67238
           Summary: [C++11][C++14]cc1plus crash for nested decltype
                    expression in parameter pack in trailing return type
                    when '-g' enabled
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frankhb1989 at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---
                CC: webrown.cpp at gmail dot com

g++ -v
...
gcc version 5.2.0 (Rev3, Built by MSYS2 project)

Case:
//a.cc
template<class F, class... A>
void
g(F&&, A&&...)
{}

template<class... A>
auto
h(A&&... a) -> decltype(g(0, g<decltype(a)>(a)...))
{
        return g([]{}, a...); // Crash if any error here.
}

int
main()
{
        h();
}

g++ a.cc -std=c++11 -g1

The frontend crashes, and no diagnostics shown for this particular case on my
machine. Otherwise there may be segfault. Same for -std=c++14, but '-g0' seems
to be OK.

BTW, it seems that nested decltype expression in trailing return types are
often buggy playing with lambdas. Should there be any other reports?

Reply via email to