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] New: Unjustified variadic template instantiation


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78966

            Bug ID: 78966
           Summary: Unjustified variadic template instantiation
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugzilla at contacts dot eelis.net
  Target Milestone: ---

Consider:

  template<typename... TT>
  struct vari
  {
    static_assert(sizeof...(TT) != 0, "bleh");
  };

  template<typename> struct X {};

  void f(void(*)(X<char>));

  template<typename... T> void f(vari<T...>);
        // if this line is commented out, code compiles fine

  template<typename T> void g(X<T>);

  void h() { f(g); }

When compiled with gcc 7.0.0 20161219, the static assert triggers:

  prog.cc: In instantiation of 'struct vari<>':
  prog.cc:16:15:   required from here
  prog.cc:4:3: error: static assertion failed: bleh
     static_assert(sizeof...(TT) != 0, "bleh");

But there's no reason for vari to be instantiated without arguments here, is
there?

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