https://bugs.llvm.org/show_bug.cgi?id=46377

            Bug ID: 46377
           Summary: Parameter pack not expanded in typedef for function
                    type
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zi...@kayari.org
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

template<typename T, typename U>
struct require_same;

template<typename T> struct require_same<T,T>
{ };

template<typename T> using int_t = int;

void (*f)();

template<typename ...Ts>
void g(Ts... args) {

  // This works
  ((void (*)(int_t<Ts>...)) f)(args...);

  // This works
  using funcptr = void (*)(decltype((void)args, 0)...);
  ((funcptr) f)(args...);

  // This is wrong
  using funcptr2 = void (*)(int_t<Ts>...);
  // The type funcptr2 only has a single parameter, pack not expanded
  require_same<funcptr, funcptr2> chk;

  // So this fails
  ((funcptr2) f)(args...);
}

void h(int x, int y) { g(x, y); }


This works with Clang 3.0 but fails with anything later. This prevents building
GCC master with Clang.

var.cc:24:35: error: implicit instantiation of undefined template
'require_same<void (*)(int, int), void (*)(int)>'
  require_same<funcptr, funcptr2> chk;
                                  ^
var.cc:30:24: note: in instantiation of function template specialization
'g<int, int>' requested here
void h(int x, int y) { g(x, y); }
                       ^
var.cc:2:8: note: template is declared here
struct require_same;
       ^
var.cc:27:18: error: too many arguments to function call, expected 1, have 2
  ((funcptr2) f)(args...);
  ~~~~~~~~~~~~~~ ^~~~
2 errors generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to