summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.decls
Commit message (Collapse)AuthorAgeFilesLines
...
* Add some more partial-ordering tests, including one that changes withDouglas Gregor2011-01-121-0/+33
| | | | | | | the proposed resolution to core isue 692. I'm not certain which way we'll go on this one. llvm-svn: 123331
* Teach TreeTransform how to transform a pack expansion type intoDouglas Gregor2011-01-121-0/+18
| | | | | | | | | another pack expansion type. This can happen when rebuilding types in the current instantiation. Fixes <rdar://problem/8848837> (Clang crashing on libc++ <functional>). llvm-svn: 123316
* Implement partial ordering of class template partial specializationsDouglas Gregor2011-01-111-0/+30
| | | | | | | | | | | | | | | | | | | | | | and function templates that contain variadic templates. This involves three small-ish changes: (1) When transforming a pack expansion, if the transformed argument still contains unexpanded parameter packs, build a pack expansion. This can happen during the substitution that occurs into class template partial specialiation template arguments during partial ordering. (2) When performing template argument deduction where the argument is a pack expansion, match against the pattern of that pack expansion. (3) When performing template argument deduction against a non-pack parameter, or a non-expansion template argument, deduction fails if the argument itself is a pack expansion (C++0x [temp.deduct.type]p22). llvm-svn: 123279
* Add testing for unexpanded parameter packs in all of the C++Douglas Gregor2011-01-111-1/+128
| | | | | | | | expression kinds. This is (indirectly) a test verifying that the recursive AST visitor is visiting the children of these expression nodes. llvm-svn: 123198
* Work-in-progress implementation of C++0x [temp.arg.explicit]p9, whichDouglas Gregor2011-01-102-4/+352
| | | | | | | | | | | | | | | | | | | | | | | | | | allows an argument pack determines via explicit specification of function template arguments to be extended by further, deduced arguments. For example: template<class ... Types> void f(Types ... values); void g() { f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int } There are a number of FIXMEs in here that indicate places where we need to implement + test retained expansions, plus a number of other places in deduction where we need to correctly cope with the explicitly-specified arguments when deducing an argument pack. Furthermore, it appears that the RecursiveASTVisitor needs to be auditied; it's missing some traversals (especially w.r.t. template arguments) that cause it not to find unexpanded parameter packs when it should. The good news, however, is that the tr1::tuple implementation now works fully, and the tr1::bind example (both from N2080) is actually working now. llvm-svn: 123163
* Variadic templates example: a nearly-complete implementation of a TR1Douglas Gregor2011-01-072-1/+87
| | | | | | function class template. llvm-svn: 123024
* Variadic templates example: a nearly-complete implementation of a TR1Douglas Gregor2011-01-071-0/+264
| | | | | | | | | | tuple class template. This implementation is boosted directly from the variadic templates proposal. N2080. Note that one section is #ifdef'd out. I'll implement that aspect of template argument deduction next. llvm-svn: 123016
* Implement substitution of a function parameter pack for its set ofDouglas Gregor2011-01-072-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | instantiated function parameters, enabling instantiation of arbitrary pack expansions involving function parameter packs. At this point, we can now correctly compile a simple, variadic print() example: #include <iostream> #include <string> void print() {} template<typename Head, typename ...Tail> void print(const Head &head, const Tail &...tail) { std::cout << head; print(tail...); } int main() { std::string hello = "Hello"; print(hello, ", world!", " ", 2011, '\n'); } llvm-svn: 123000
* Initial implementation of function parameter packs. This implementation allows:Douglas Gregor2011-01-051-0/+24
| | | | | | | | | | | | | | 1) Declaration of function parameter packs 2) Instantiation of function parameter packs within function types. 3) Template argument deduction of function parameter packs when matching two function types. We're missing all of the important template-instantiation logic for function template definitions, along with template argument deduction from the argument list of a function call, so don't even think of trying to use these for real yet. llvm-svn: 122926
* When we're converting deduced template arguments to the type of theDouglas Gregor2011-01-051-0/+27
| | | | | | | corresponding template parameter, make sure that prior converted template arguments are available for substitution. llvm-svn: 122902
* Replace the representation of template template argument packDouglas Gregor2011-01-052-1/+41
| | | | | | | | | | | | | expansions with something that is easier to use correctly: a new template argment kind, rather than a bit on an existing kind. Update all of the switch statements that deal with template arguments, fixing a few latent bugs in the process. I"m happy with this representation, now. And, oh look! Template instantiation and deduction work for template template argument pack expansions. llvm-svn: 122896
* Implement proper parameter pack matching for non-type templateDouglas Gregor2011-01-051-7/+11
| | | | | | parameters and template template parameters. llvm-svn: 122875
* Implement support for template template parameter packs, e.g.,Douglas Gregor2011-01-053-0/+33
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* Improve our handling of non-type template parameters in partialDouglas Gregor2011-01-042-0/+51
| | | | | | | | | | | | | specializations. We weren't dealing with any of the cases where the type of the non-type template argument differs from the type of the corresponding template parameter in the primary template. We would think that the template parameter in the partial specialization was not deducible (and warn about it, incorrectly), then fail to convert a deduced parameter to the type of the template parameter in the partial specialization (which may involve truncation, among other things). Fixes PR8905. llvm-svn: 122851
* Improve the checking of deduced template arguments stored within template ↵Douglas Gregor2011-01-041-0/+25
| | | | | | argument packs when finishing template argument deduction for a function template llvm-svn: 122843
* When creating the injected-class-name for a class template involving aDouglas Gregor2011-01-041-3/+0
| | | | | | | non-type template parameter pack, make sure to create a pack expansion for the corresponding template argument. llvm-svn: 122799
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-2/+30
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
* Implement pack expansions whose pattern is a base-specifier.Douglas Gregor2011-01-031-0/+18
| | | | llvm-svn: 122782
* Add a test that is currently failingDouglas Gregor2011-01-031-0/+14
| | | | llvm-svn: 122780
* Properly rebuild pack expansions whose pattern is a non-type templateDouglas Gregor2011-01-032-1/+13
| | | | | | | argument. As part of this, be more careful when determining if there are any parameter packs that cannot be expanded. llvm-svn: 122776
* Unwrap template argument packs when checking the template arguments ofDouglas Gregor2011-01-031-0/+8
| | | | | | | a class template partial specialiation, and look through pack expansions when checking the conditions of C++0x [temp.class.spec]p8. llvm-svn: 122774
* Diagnose the presence of unexpanded parameter packs within classDouglas Gregor2011-01-031-4/+4
| | | | | | template partial specialization arguments. llvm-svn: 122769
* Implement support for pack expansions in initializer lists andDouglas Gregor2011-01-031-0/+14
| | | | | | expression lists. llvm-svn: 122764
* Another variadic template metafunction test case: summing values.Douglas Gregor2011-01-031-2/+16
| | | | llvm-svn: 122752
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-031-0/+49
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* Consolidate template metafunction tests for variadic templates into a single ↵Douglas Gregor2011-01-032-28/+32
| | | | | | file llvm-svn: 122748
* When instantiating a non-type template parameter pack, be sure toDouglas Gregor2010-12-241-5/+25
| | | | | | | | extract the appropriate argument from the argument pack (based on the current substitution index, of course). Simple instantiation of pack expansions involving non-type template parameter packs now works. llvm-svn: 122532
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-0/+20
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* Reimplement the comparison of a class template partialDouglas Gregor2010-12-231-0/+13
| | | | | | | | | | | specialization's template arguments against the primary template's template arguments using the obvious, correct method of checking the injected-class-name type (C++ [temp.class.spec]p9b3). The previous incarnation of this comparison attempted to use its own formulation of the injected-class-name, which is redudant and, with the introduction of variadic templates, became wrong (again). llvm-svn: 122508
* When forming the injected-class-name of a variadic template, theDouglas Gregor2010-12-231-0/+41
| | | | | | | | | template argument corresponding to a template parameter pack is an argument pack of a pack expansion of that template parameter pack. Implements C++0x [temp.dep.type]p2 (at least, as much of it as we can). llvm-svn: 122498
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-11/+30
| | | | | | | | | | | pattern is a template argument, which involves repeatedly deducing template arguments using the pattern of the pack expansion, then bundling the resulting deductions into an argument pack. We can now handle a variety of simple list-handling metaprograms using variadic templates. See, e.g., the new "count" metaprogram. llvm-svn: 122439
* When performing template argument deduction where the argument is aDouglas Gregor2010-12-221-0/+26
| | | | | | | | | | dependent template specialization type, the number of template arguments need not match precisely. Rather than checking the number of arguments eagerly (which does not consider argument packs), let the deduction routine for template argument lists cope with too many/too few arguments. llvm-svn: 122425
* Implicitly expand argument packs when performing template argumentDouglas Gregor2010-12-221-0/+17
| | | | | | | | | | | | deduction. Unify all of the looping over template arguments for deduction purposes into a single place, where argument pack expansion occurs; this is also the hook for deducing from pack expansions, which itself is not yet implemented. For now, at least we can handle a basic "count" metafunction written with variadics. See the new test for the formulation that works. llvm-svn: 122418
* Add test for C++ [temp.friend]p8, which bans partial specializations from ↵Douglas Gregor2010-12-211-0/+6
| | | | | | being friends llvm-svn: 122335
* Implement instantiation of pack expansions whose pattern is a type-idDouglas Gregor2010-12-211-6/+6
| | | | | | in an exception specification. llvm-svn: 122297
* Extend the parser to support pack expansions within exceptionDouglas Gregor2010-12-201-0/+18
| | | | | | | specifications. We can't yet instantiate them, however, since I tripped over PR8835. llvm-svn: 122292
* Test template instantiation of pack expansions where the parameter pack is ↵Douglas Gregor2010-12-201-3/+16
| | | | | | in a nested-name-specifier llvm-svn: 122282
* Clean up the printing of template argument packs; previously, we wereDouglas Gregor2010-12-202-2/+2
| | | | | | getting extra "<>" delimiters around template argument packs. llvm-svn: 122280
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-202-0/+34
| | | | | | | | | | | | | | | | | whose patterns are template arguments. We can now instantiate, e.g., typedef tuple<pair<OuterTypes, InnerTypes>...> type; where OuterTypes and InnerTypes are template type parameter packs. There is a horrible inefficiency in TemplateArgumentLoc::getPackExpansionPattern(), where we need to create copies of TypeLoc data because our interfaces traffic in TypeSourceInfo pointers where they should traffic in TypeLocs instead. I've isolated in efficiency in this one routine; once we refactor our interfaces to traffic in TypeLocs, we can eliminate it. llvm-svn: 122278
* When checking a template argument list against a template containingDouglas Gregor2010-12-201-0/+9
| | | | | | | | | | | | a parameter pack, check the parameter pack against each of the template arguments it corresponds to, then pack the converted arguments into a template argument pack. Allows us to use variadic class templates so long as instantiation isn't required, e.g., template<typename... Types> struct Tuple; Tuple<int, float> *t2; llvm-svn: 122251
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-201-2/+14
| | | | | | | | | | | | | | | | | | | | pack expansions, e.g. given template<typename... Types> struct tuple; template<typename... Types> struct tuple_of_refs { typedef tuple<Types&...> types; }; the type of the "types" typedef is a PackExpansionType whose pattern is Types&. This commit introduces support for creating pack expansions for template type arguments, as above, but not for any other kind of pack expansion, nor for any form of instantiation. llvm-svn: 122223
* Add tests checking for unexpanded parameter packs in declarations thatDouglas Gregor2010-12-161-1/+20
| | | | | | | occur within statements. Teach Sema::ActOnExceptionDeclarator() to check for unexpanded parameter packs in the exception type. llvm-svn: 121984
* Check for unexpanded parameter packs in non-type template parameter types.Douglas Gregor2010-12-161-0/+3
| | | | llvm-svn: 121964
* Check for unexpanded parameter packs in default arguments.Douglas Gregor2010-12-161-0/+9
| | | | llvm-svn: 121962
* Check for unexpanded parameter packs within variable initializers.Douglas Gregor2010-12-161-0/+7
| | | | llvm-svn: 121938
* Check for unexpanded parameter packs in friend declarations.Douglas Gregor2010-12-161-0/+4
| | | | llvm-svn: 121934
* Check for unexpanded parameter packs in using declarations. As aDouglas Gregor2010-12-161-2/+7
| | | | | | | drive-by, make sure to check for unexpanded parameter packs within the name of a declaration. llvm-svn: 121930
* Check for unexpanded parameter packs in enumeration types and enumerators.Douglas Gregor2010-12-161-0/+4
| | | | llvm-svn: 121928
* Check for unexpanded parameter packs in static assertion expressions.Douglas Gregor2010-12-151-0/+1
| | | | llvm-svn: 121922
* Check for unexpanded parameter packs in various kinds ofDouglas Gregor2010-12-151-0/+15
| | | | | | | | declarations. This is a work in progress, as I go through the C++ declaration grammar to identify where unexpanded parameter packs can occur. llvm-svn: 121912
OpenPOWER on IntegriCloud