+2015-12-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/63628
+       * pt.c (tsubst_pack_expansion): Also make dummy decls if
+       retrieve_local_specialization fails.
+
 2015-12-16  David Malcolm  <dmalcolm@redhat.com>
 
        * parser.c (cp_lexer_peek_conflict_marker): New function.
 
          if (PACK_EXPANSION_LOCAL_P (t) || CONSTRAINT_VAR_P (parm_pack))
            arg_pack = retrieve_local_specialization (parm_pack);
          else
+           /* We can't rely on local_specializations for a parameter
+              name used later in a function declaration (such as in a
+              late-specified return type).  Even if it exists, it might
+              have the wrong value for a recursive call.  */
+           need_local_specializations = true;
+
+         if (!arg_pack)
            {
-             /* We can't rely on local_specializations for a parameter
-                name used later in a function declaration (such as in a
-                late-specified return type).  Even if it exists, it might
-                have the wrong value for a recursive call.  Just make a
-                dummy decl, since it's only used for its type.  */
+             /* This parameter pack was used in an unevaluated context.  Just
+                make a dummy decl, since it's only used for its type.  */
              arg_pack = tsubst_decl (parm_pack, args, complain);
              if (arg_pack && DECL_PACK_P (arg_pack))
                /* Partial instantiation of the parm_pack, we can't build
                arg_pack = NULL_TREE;
              else
                arg_pack = make_fnparm_pack (arg_pack);
-             need_local_specializations = true;
            }
        }
       else if (TREE_CODE (parm_pack) == FIELD_DECL)
 
--- /dev/null
+// PR c++/63628
+// { dg-do compile { target c++14 } }
+
+auto const pack = [](auto&&... t)
+{
+  return [&](auto&& f)->decltype(auto)
+  {
+    return f(static_cast<decltype(t)>(t)...);
+  };
+};
+
+int main(int argc, char** argv) {
+  pack(1)([](int){});
+  return 0;
+}