https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82331
Bug ID: 82331
Summary: ICE specializing template<auto> for function pointer
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ambrop7 at gmail dot com
Target Milestone: ---
The code below crashes the compiler (compile with -std=c++17).
gcccrash.cpp: In function ‘int test()’:
gcccrash.cpp:15:30: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:11514
int test () { return X<&func>::call(1, 2); }
template <auto>
class X;
template <typename R, typename... A, R (*F) (A...)>
class X<F> {
public:
static R call (A... args)
{
return (*F)(args...);
}
};
int func (int a, int b) { return a + b; }
int test () { return X<&func>::call(1, 2); }