gcc internal error when using variadic concept template

Viewed 137

I recently played around with the concepts feature in gcc and stumbled upon this error when using variadic concept templates in the constructor or member function of a class:

template<typename From, typename To>
concept bool ConvertibleNoNarrow = requires(From f, To t) {
    t = { f };
};

class Foo
{
public:
    template<ConvertibleNoNarrow<double>... Args>
    Foo(Args&&... args) { /*...*/ }
};

When using Foo, gcc shows an internal error:

err.cpp: In substitution of ‘template<class ... Args>  requires  ConvertibleNoNarrow<Args, double>... Foo::Foo(Args&& ...) [with Args = {double}]’:
err.cpp:23:11:   required from here
err.cpp:13:3: internal compiler error: in tsubst_constraint, at cp/constraint.cc:1956
   Foo(Args&&... args) { }
   ^~~

If the same signature is used in a global function, everything works as expected:

/* works */    
template<ConvertibleNoNarrow<double>... Args>
void Test(Args&&... args) { }

Can anyone reproduce this or has a clue why this happens and how an existing bug report might be called?

EDIT:

My gcc version:

gcc (Gentoo 7.2.0 p1.1) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2 Answers
Related