p5.cpp revision 9ef75899bae6dd9a4be1252ae9cadcb619c170ff
1d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor 3d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor 4d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor// An appearance of a name of a parameter pack that is not expanded is 5d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor// ill-formed. 6d0937224f383c7cc72c947119380f9713a070c73Douglas Gregortemplate<typename ... Types> 7d0937224f383c7cc72c947119380f9713a070c73Douglas Gregorstruct TestPPName 89ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor : public Types // expected-error{{base type contains unexpanded parameter pack 'Types'}} 9d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor{ 109ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef Types *types_pointer; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} 11d0937224f383c7cc72c947119380f9713a070c73Douglas Gregor}; 12bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregor 13bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregortemplate<typename ... Types> 14bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregorvoid TestPPNameFunc(int i) { 159ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor f(static_cast<Types>(i)); // expected-error{{expression contains unexpanded parameter pack 'Types'}} 16bebbe0d9b7568ce43a464286bee49429489ef483Douglas Gregor} 179ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 189ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregortemplate<typename T, typename U> struct pair; 199ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 209ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregortemplate<typename ...OuterTypes> 219ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregorstruct MemberTemplatePPNames { 229ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor template<typename ...InnerTypes> 239ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor struct Inner { 249ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef pair<OuterTypes, InnerTypes>* types; // expected-error{{declaration type contains unexpanded parameter packs 'OuterTypes' and 'InnerTypes'}} 259ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor 269ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor template<typename ...VeryInnerTypes> 279ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor struct VeryInner { 289ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor typedef pair<pair<VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types; // expected-error{{declaration type contains unexpanded parameter packs 'VeryInnerTypes', 'OuterTypes', ...}} 299ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor }; 309ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor }; 319ef75899bae6dd9a4be1252ae9cadcb619c170ffDouglas Gregor}; 32