[Bug c++/88580] New: Parameter pack expansion fails (variadic constructor template inside a variadic class template)
philodej at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Dec 23 00:04:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88580
Bug ID: 88580
Summary: Parameter pack expansion fails (variadic constructor
template inside a variadic class template)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: philodej at gmail dot com
Target Milestone: ---
The following simple code snippet compiles as expected on clang, msvc and icc,
but fails to compile on gcc (any version I have tried):
[https://godbolt.org/z/2uLKgn]
#include <string>
struct Policy {
explicit Policy(std::string arg) {}
};
template <typename... Base>
struct Scope : private Base... {
template <typename... T>
Scope(T&&... args)
: Base(std::forward<T>(args)...)... {
}
};
int main() {
const auto scope = Scope<Policy>{std::string{}};
}
... with following (seemingly meaningless) error:
error: no matching function for call to 'Policy::Policy(bool)'
If any of the parameter packs is replaced with a single template parameter then
the code compiles OK. So it seems that compiler is confused by combination of
two pack expansions.
Sorry if this kind of error has been reported already (I know that there are
already several bugs reported regarding variadic template parameter expansion
but none of them seemed to me identical to this one).
More information about the Gcc-bugs
mailing list