This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78966] Unjustified variadic template instantiation
- From: "gcc-bugzilla at contacts dot eelis.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 06 Jan 2017 20:11:36 +0000
- Subject: [Bug c++/78966] Unjustified variadic template instantiation
- Auto-submitted: auto-generated
- References: <bug-78966-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78966
Eelis <gcc-bugzilla at contacts dot eelis.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #6 from Eelis <gcc-bugzilla at contacts dot eelis.net> ---
Ah, thanks for the explanation! That makes sense.
I guess that to avoid this problem, one should adhere to a rule along the lines
of:
"If you're about to write a function like
template<typename... T>
R f(X<T...>);
then if f is potentially overloaded, and X cannot be instantiated with an empty
pack, you better write f as:
template<typename T, typename... Ts>
R f(X<T, Ts...>)
because otherwise calls to those other fs may end up requiring X to be
instantiable with an empty pack."
I now use this workaround for my operator<< for std::variant.
Closing.