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++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type


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

            Bug ID: 67898
           Summary: rejects-valid on overloaded function as non-type
                    template argument of dependent type
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

Test case:

  void f(int);
  void f(float);
  template<typename T, T F, T G, bool b = F == G> struct X {};
  template<typename T> void test() { X<void(T), f, f>(); }
  int main() { test<int>(); }

GCC rejects this valid code saying:

  <stdin>:4:51: error: âvoid(T)â is not a valid type for a template non-type
parameter
  <stdin>:4:51: error: âvoid(T)â is not a valid type for a template non-type
parameter
  <stdin>:4:51: error: template argument 4 is invalid

If we work around this bug by changing the code as follows:

  template<typename T> void test() { X<void(*)(T), f, f>(); }

... then we get a different rejects-valid:

  <stdin>:3:43: error: invalid operands of types â<unresolved overloaded
function type>â and â<unresolved overloaded function type>â to binary
âoperator==â
  <stdin>:4:54: error: template argument 4 is invalid

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