1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify %s 2d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor 37536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregortemplate<typename T, typename U> struct pair; 48491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregortemplate<typename ...> struct tuple; 57536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor 67536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// A parameter pack whose name appears within the pattern of a pack 77536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// expansion is expanded by that pack expansion. An appearance of the 87536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// name of a parameter pack is only expanded by the innermost 97536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// enclosing pack expansion. The pattern of a pack expansion shall 107536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// name one or more parameter packs that are not expanded by a nested 117536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor// pack expansion. 127536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregortemplate<typename... Types> 137536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregorstruct Expansion { 147536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor typedef pair<Types..., int> expand_with_pacs; // okay 157536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor typedef pair<Types, int...> expand_no_packs; // expected-error{{pack expansion does not contain any unexpanded parameter packs}} 167536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor typedef pair<pair<Types..., int>..., int> expand_with_expanded_nested; // expected-error{{pack expansion does not contain any unexpanded parameter packs}} 177536dd5e6c99584481b7dab68b7e7d8df9c54054Douglas Gregor}; 18d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor 198491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor// All of the parameter packs expanded by a pack expansion shall have 208491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor// the same number of arguments specified. 218491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregortemplate<typename ...Types> 228491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregorstruct ExpansionLengthMismatch { 238491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor template<typename ...OtherTypes> 248491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor struct Inner { 258491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor typedef tuple<pair<Types, OtherTypes>...> type; // expected-error{{pack expansion contains parameter packs 'Types' and 'OtherTypes' that have different lengths (3 vs. 2)}} 268491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor }; 278491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor}; 288491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor 298491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas GregorExpansionLengthMismatch<int, long>::Inner<unsigned int, unsigned long>::type 308491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor *il_pairs; 318491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregortuple<pair<int, unsigned int>, pair<long, unsigned long> >*il_pairs_2 = il_pairs; 328491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor 33dace95b13e2ceb0c3ec8de6babd926dc5114e1e5Douglas GregorExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>::type // expected-note{{in instantiation of template class 'ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>' requested here}} 348491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor *il_pairs_bad; 358491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor 368491ffe86c50241b47c6d7ef8cd9ee00f5e675daDouglas Gregor 37d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor// An appearance of a name of a parameter pack that is not expanded is 38d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor// ill-formed. 39cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 40cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor// Test for unexpanded parameter packs in each of the type nodes. 41cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregortemplate<typename T, int N, typename ... Types> 42d0937224f383c7cc72c947119380f9713a070c73Douglas Gregorstruct TestPPName 43cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor : public Types, public T // expected-error{{base type contains unexpanded parameter pack 'Types'}} 44d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor{ 45cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // BuiltinType is uninteresting 46cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // FIXME: ComplexType is uninteresting? 47cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // PointerType 489ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef Types *types_pointer; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 49cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 50cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // BlockPointerType 51cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types (^block_pointer_1)(int); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 52cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef int (^block_pointer_2)(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 53cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 54cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // LValueReferenceType 55cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types &lvalue_ref; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 56cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 57cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // RValueReferenceType 58cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types &&rvalue_ref; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 59cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 60cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // MemberPointerType 61cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types TestPPName::* member_pointer_1; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 62cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef int Types::*member_pointer_2; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 63cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 64cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ConstantArrayType 65cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types constant_array[17]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 66cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 67cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // IncompleteArrayType 68cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types incomplete_array[]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 69cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 70cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // VariableArrayType 71cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor void f(int i) { 72cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor Types variable_array[i]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 73cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor } 74cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 75cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // DependentSizedArrayType 76cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types dependent_sized_array[N]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 77cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 78cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // DependentSizedExtVectorType 79cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types dependent_sized_ext_vector __attribute__((ext_vector_type(N))); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 80cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 81cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // VectorType is uninteresting 82cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 83cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ExtVectorType 84cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types ext_vector __attribute__((ext_vector_type(4))); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 85cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 86cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // FunctionProtoType 87cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types (function_type_1)(int); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 88cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef int (function_type_2)(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 89cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 90cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // FunctionNoProtoType is uninteresting 91cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // UnresolvedUsingType is uninteresting 92cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ParenType is uninteresting 93cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // TypedefType is uninteresting 94cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 95cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // TypeOfExprType 96cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef __typeof__((static_cast<Types>(0))) typeof_expr; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 97cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 98cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // TypeOfType 99cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef __typeof__(Types) typeof_type; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 100cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 101cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // DecltypeType 102cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef decltype((static_cast<Types>(0))) typeof_expr; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 103cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 104cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // RecordType is uninteresting 105cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // EnumType is uninteresting 106cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ElaboratedType is uninteresting 107cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 108cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // TemplateTypeParmType 109cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef Types template_type_parm; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 110cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 111cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // SubstTemplateTypeParmType is uninteresting 112cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 113cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // TemplateSpecializationType 114cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef pair<Types, int> template_specialization; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 115cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 116cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // InjectedClassName is uninteresting. 117cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 118cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // DependentNameType 119cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef typename Types::type dependent_name; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 120cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 121cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // DependentTemplateSpecializationType 122cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef typename Types::template apply<int> dependent_name_1; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 123cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor typedef typename T::template apply<Types> dependent_name_2; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 124cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor 125cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ObjCObjectType is uninteresting 126cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ObjCInterfaceType is uninteresting 127cff163e3cc78277496b30fa40070b46abdc290dbDouglas Gregor // ObjCObjectPointerType is uninteresting 128d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor}; 129bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregor 130e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor// FIXME: Test for unexpanded parameter packs in each of the expression nodes. 13110738d36b150aa65206890c1c845cdba076e4200Douglas Gregortemplate<int ...Values> 13210738d36b150aa65206890c1c845cdba076e4200Douglas Gregorvoid test_unexpanded_in_exprs() { 13310738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // PredefinedExpr is uninteresting 13410738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // DeclRefExpr 13510738d36b150aa65206890c1c845cdba076e4200Douglas Gregor Values; // expected-error{{expression contains unexpanded parameter pack 'Values'}} 13610738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // IntegerLiteral is uninteresting 13710738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // FloatingLiteral is uninteresting 13810738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // ImaginaryLiteral is uninteresting 13910738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // StringLiteral is uninteresting 14010738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // CharacterLiteral is uninteresting 14110738d36b150aa65206890c1c845cdba076e4200Douglas Gregor (Values); // expected-error{{expression contains unexpanded parameter pack 'Values'}} 14210738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // UnaryOperator 14310738d36b150aa65206890c1c845cdba076e4200Douglas Gregor -Values; // expected-error{{expression contains unexpanded parameter pack 'Values'}} 14410738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // OffsetOfExpr 14510738d36b150aa65206890c1c845cdba076e4200Douglas Gregor struct OffsetMe { 14610738d36b150aa65206890c1c845cdba076e4200Douglas Gregor int array[17]; 14710738d36b150aa65206890c1c845cdba076e4200Douglas Gregor }; 14810738d36b150aa65206890c1c845cdba076e4200Douglas Gregor __builtin_offsetof(OffsetMe, array[Values]); // expected-error{{expression contains unexpanded parameter pack 'Values'}} 14910738d36b150aa65206890c1c845cdba076e4200Douglas Gregor // FIXME: continue this... 15010738d36b150aa65206890c1c845cdba076e4200Douglas Gregor} 151e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor 152bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregortemplate<typename ... Types> 153bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregorvoid TestPPNameFunc(int i) { 1549ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor f(static_cast<Types>(i)); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 155bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregor} 1569ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 15761c4d28e36cd3f1be392cb77f07436d1fa6b0f9fDouglas Gregortemplate<typename T, template<class> class ...Meta> 15861c4d28e36cd3f1be392cb77f07436d1fa6b0f9fDouglas Gregorstruct TestUnexpandedTTP { 15961c4d28e36cd3f1be392cb77f07436d1fa6b0f9fDouglas Gregor typedef tuple<typename Meta<T>::type> type; // expected-error{{declaration type contains unexpanded parameter pack 'Meta'}} 16061c4d28e36cd3f1be392cb77f07436d1fa6b0f9fDouglas Gregor}; 16161c4d28e36cd3f1be392cb77f07436d1fa6b0f9fDouglas Gregor 162a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor// Test for unexpanded parameter packs in declarations. 163a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor// FIXME: Attributes? 16456c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregortemplate<typename T, typename... Types> 16556c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregorstruct TestUnexpandedDecls : T{ 166e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 167e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor void member_function () throw(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 16856c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregor operator Types() const; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 169e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}} 170e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor static Types static_data_member; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 171e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor unsigned bit_field : static_cast<Types>(0); // expected-error{{bit-field size contains unexpanded parameter pack 'Types'}} 172399ad970a25efcbfa7111e17f48285a70fba2731Douglas Gregor static_assert(static_cast<Types>(0), "Boom"); // expected-error{{static assertion contains unexpanded parameter pack 'Types'}} 1730c9e4799fd78d350a037498b2c797f2b2558791cDouglas Gregor 1740c9e4799fd78d350a037498b2c797f2b2558791cDouglas Gregor enum E0 : Types { // expected-error{{fixed underlying type contains unexpanded parameter pack 'Types'}} 1750c9e4799fd78d350a037498b2c797f2b2558791cDouglas Gregor EnumValue = static_cast<Types>(0) // expected-error{{enumerator value contains unexpanded parameter pack 'Types'}} 1760c9e4799fd78d350a037498b2c797f2b2558791cDouglas Gregor }; 17756c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregor 17856c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregor using typename Types::type; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}} 17956c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregor using Types::value; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}} 18056c04588ef3cfa1bbc968fd68de2480a4e66971dDouglas Gregor using T::operator Types; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}} 1816ccab97c17c17f38eb92c7fe02c766508875bd97Douglas Gregor 1826ccab97c17c17f38eb92c7fe02c766508875bd97Douglas Gregor friend class Types::foo; // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}} 1836ccab97c17c17f38eb92c7fe02c766508875bd97Douglas Gregor friend void friend_func(Types); // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}} 1846ccab97c17c17f38eb92c7fe02c766508875bd97Douglas Gregor friend void Types::other_friend_func(int); // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}} 185a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor 186a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor void test_initializers() { 187a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor T copy_init = static_cast<Types>(0); // expected-error{{initializer contains unexpanded parameter pack 'Types'}} 188a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor T direct_init(0, static_cast<Types>(0)); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 189a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor T list_init = { static_cast<Types>(0) }; // expected-error{{initializer contains unexpanded parameter pack 'Types'}} 190a31040f16604849b3b1dc36015056c81bae68ad1Douglas Gregor } 1916f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor 1926f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor void default_function_args(T = static_cast<Types>(0)); // expected-error{{default argument contains unexpanded parameter pack 'Types'}} 1936f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor 1946f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor template<typename = Types*> // expected-error{{default argument contains unexpanded parameter pack 'Types'}} 1956f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor struct default_template_args_1; 1966f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor template<int = static_cast<Types>(0)> // expected-error{{default argument contains unexpanded parameter pack 'Types'}} 1976f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor struct default_template_args_2; 1986f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor template<template<typename> class = Types::template apply> // expected-error{{default argument contains unexpanded parameter pack 'Types'}} 1996f52675ec400a0ee89ec6214c4845b8ee274304aDouglas Gregor struct default_template_args_3; 200781def075d4a486a5b367c6730fe77cb1f721ac1Douglas Gregor 201781def075d4a486a5b367c6730fe77cb1f721ac1Douglas Gregor template<Types value> // expected-error{{non-type template parameter type contains unexpanded parameter pack 'Types'}} 202781def075d4a486a5b367c6730fe77cb1f721ac1Douglas Gregor struct non_type_template_param_type; 203a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor 204a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor void decls_in_stmts() { 205a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor Types t; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 206a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor for (Types *t = 0; ; ) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 207a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor for (; Types *t = 0; ) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 208ad762fcdc16b9e4705b12b09d92b8c026212b906Richard Smith T a[] = { T(), T(), T() }; 209ad762fcdc16b9e4705b12b09d92b8c026212b906Richard Smith for (Types t : a) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 210a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor switch(Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 211a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor while(Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 212a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor if (Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 213a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor try { 214a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor } catch (Types*) { // expected-error{{exception type contains unexpanded parameter pack 'Types'}} 215a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor } 216a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor } 217e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor}; 218e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor 219a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor// FIXME: Test for unexpanded parameter packs in each of the statements. 22010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregorstruct X { 22110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor void f(int, int); 22210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor template<typename ...Types> 22310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor void f(Types...); 22410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor}; 22510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 22610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregornamespace std { 22710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor class type_info; 22810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor} 22910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 23010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregortypedef struct _GUID { 23110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor unsigned long Data1; 23210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor unsigned short Data2; 23310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor unsigned short Data3; 23410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor unsigned char Data4[ 8 ]; 23510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor} GUID; 23610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 23710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregortemplate<typename T, typename ...Types> 23810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregorvoid test_unexpanded_exprs(Types ...values) { 23910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXOperatorCallExpr 24010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)(values + 0); // expected-error{{expression contains unexpanded parameter pack 'values'}} 24110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)(0 + values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 24210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 24310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXMemberCallExpr 24410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor values.f(); // expected-error{{expression contains unexpanded parameter pack 'values'}} 24510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor X x; 24610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor x.f(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 24710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor x.Types::f(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 24810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor x.f<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 24910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 25010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXStaticCastExpr 25110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)static_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}} 25210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 25310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXDynamicCastExpr 25410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)dynamic_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}} 25510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 25610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXReinterpretCastExpr 25710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)reinterpret_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}} 25810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 25910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXConstCastExpr 26010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)const_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}} 26110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 26210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXTypeidExpr 26310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)typeid(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 26410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)typeid(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 26510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 26610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXUuidofExpr 26710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)__uuidof(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 26810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)__uuidof(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 26910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 27010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXThisExpr is uninteresting 27110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 27210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXThrowExpr 27310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor throw Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 27410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor throw values; // expected-error{{expression contains unexpanded parameter pack 'values'}} 27510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 27610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXDefaultArgExpr is uninteresting 27710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 27810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXBindTemporaryExpr is uninteresting 27910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 28010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXConstructExpr is uninteresting 28110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 28210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXFunctionalCastExpr 28310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 28410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 28510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXTemporaryObjectExpr 28610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 28710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 28810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXScalarValueInitExpr is uninteresting 28910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 29010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXNewExpr 29110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)new Types; // expected-error{{expression contains unexpanded parameter pack 'Types'}} 29210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)new X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 29310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)new (values) X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 29410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor (void)new X [values]; // expected-error{{expression contains unexpanded parameter pack 'values'}} 29510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 29610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXDeleteExpr 29710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor delete values; // expected-error{{expression contains unexpanded parameter pack 'values'}} 29810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor delete [] values; // expected-error{{expression contains unexpanded parameter pack 'values'}} 29910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 30010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXPseudoDestructorExpr 30110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor T t; 30210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor values.~T(); // expected-error{{expression contains unexpanded parameter pack 'values'}} 30310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor t.~Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 30410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor t.Types::~T(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 30510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 30610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // UnaryTypeTraitExpr 30710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor __is_pod(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 30810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 30910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // BinaryTypeTraitExpr 31010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor __is_base_of(Types, T); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 31110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor __is_base_of(T, Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 31210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 31310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // UnresolvedLookupExpr 31410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor test_unexpanded_exprs(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 31510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor test_unexpanded_exprs<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 31610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 31710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // DependentScopeDeclRefExpr 31810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor Types::test_unexpanded_exprs(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 31910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor T::template test_unexpanded_exprs<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 32010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 32110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXUnresolvedConstructExpr 32210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor Types(5); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 32310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 32410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXDependentScopeMemberExpr 32510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor values.foo(); // expected-error{{expression contains unexpanded parameter pack 'values'}} 32610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor t.foo(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 32710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 32810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // FIXME: There's an evil ambiguity here, because we don't know if 32910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // Types refers to the template type parameter pack in scope or a 33010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // non-pack member. 33110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // t.Types::foo(); 33210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 33310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor t.template foo<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 33410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 33510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // UnresolvedMemberExpr 33610ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor x.f<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 33710ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor x.f(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 33810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 33910ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // CXXNoexceptExpr 34010ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor noexcept(values); // expected-error{{expression contains unexpanded parameter pack 'values'}} 34110ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 34210ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // PackExpansionExpr is uninteresting 34310ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // SizeOfPackExpr is uninteresting 34410ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor 34510ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor // FIXME: Objective-C expressions will need to go elsewhere 346ad762fcdc16b9e4705b12b09d92b8c026212b906Richard Smith 347ad762fcdc16b9e4705b12b09d92b8c026212b906Richard Smith for (auto t : values) { } // expected-error{{expression contains unexpanded parameter pack 'values'}} 34810ffc00e2177f042808f507c8dd50b744ed6f738Douglas Gregor} 349a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor 350925910d488051cbd4e38f350c1e9d69c473f09a0Douglas Gregor// Test unexpanded parameter packs in partial specializations. 351925910d488051cbd4e38f350c1e9d69c473f09a0Douglas Gregortemplate<typename ...Types> 352925910d488051cbd4e38f350c1e9d69c473f09a0Douglas Gregorstruct TestUnexpandedDecls<int, Types>; // expected-error{{partial specialization contains unexpanded parameter pack 'Types'}} 353a669c534cf414339060868d70d2348fea9ce6c7dDouglas Gregor 354e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor// Test for diagnostics in the presence of multiple unexpanded 355e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor// parameter packs. 3569ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregortemplate<typename T, typename U> struct pair; 3579ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 3589ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregortemplate<typename ...OuterTypes> 3599ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregorstruct MemberTemplatePPNames { 3609ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor template<typename ...InnerTypes> 3619ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor struct Inner { 3629ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef pair<OuterTypes, InnerTypes>* types; // expected-error{{declaration type contains unexpanded parameter packs 'OuterTypes' and 'InnerTypes'}} 3639ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 3649ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor template<typename ...VeryInnerTypes> 3659ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor struct VeryInner { 3669ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef pair<pair<VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types; // expected-error{{declaration type contains unexpanded parameter packs 'VeryInnerTypes', 'OuterTypes', ...}} 3679ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor }; 3689ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor }; 3699ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor}; 370e186269a8a41dbff1ebea2c251048892979d1078Douglas Gregor 37112c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor// Example from working paper 37212c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregornamespace WorkingPaperExample { 37312c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<typename...> struct Tuple {}; 37412c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<typename T1, typename T2> struct Pair {}; 37512c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor 37612c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<class ... Args1> struct zip { 37712c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<class ... Args2> struct with { 37812c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor typedef Tuple<Pair<Args1, Args2> ... > type; // expected-error{{pack expansion contains parameter packs 'Args1' and 'Args2' that have different lengths (1 vs. 2)}} 37912c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor }; 38012c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor }; 38112c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor 38212c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor typedef zip<short, int>::with<unsigned short, unsigned>::type T1; // T1 is Tuple<Pair<short, unsigned short>, Pair<int, unsigned>> 38312c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor typedef Tuple<Pair<short, unsigned short>, Pair<int, unsigned>> T1; 38412c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor 38512c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor typedef zip<short>::with<unsigned short, unsigned>::type T2; // expected-note{{in instantiation of template class}} 38612c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor 38712c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<class ... Args> void f(Args...); 38812c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<class ... Args> void h(Args...); 38912c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor 39012c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor template<class ... Args> 39112c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor void g(Args ... args) { 39212c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor f(const_cast<const Args*>(&args)...); // OK: "Args" and "args" are expanded within f 39312c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor f(5 ...); // expected-error{{pack expansion does not contain any unexpanded parameter packs}} 39412c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor f(args); // expected-error{{expression contains unexpanded parameter pack 'args'}} 39512c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor f(h(args ...) + args ...); 39612c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor } 39712c9c00024a01819e3a70ef6d951d32efaeb9312Douglas Gregor} 398