Following code cannot compile with gcc: template<typename ...> struct foo { typedef void type; }; template<typename ...Ts> auto g(Ts ...ts)-> typename foo<decltype(ts)...>::type {} int main() { g(42); } Error: test1.cpp: In function 'int main()': test1.cpp:8:9: error: expansion pattern 'int' contains no argument packs test1.cpp:8:9: error: no matching function for call to 'g(int)' test1.cpp:8:9: note: candidate is: test1.cpp:4:6: note: template<class ... Ts> typename foo<decltype (ts)...>::type g(Ts ...) I think decltype(fs()) is a valid template-argument pattern for foo.
Author: jason Date: Fri Dec 23 22:00:13 2011 New Revision: 182668 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182668 Log: PR c++/51507 * search.c (at_function_scope_p): Also check cfun. * pt.c (tsubst_pack_expansion): Check it instead of cp_unevaluated_operand. (instantiate_template_1): Clear current_function_decl. Added: trunk/gcc/testsuite/g++.dg/cpp0x/variadic121.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/cp/search.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.7.