This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78966] Unjustified variadic template instantiation


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]