| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
the proposed resolution to core isue 692. I'm not certain which way
we'll go on this one.
llvm-svn: 123331
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
expression kinds. This is (indirectly) a test verifying that the
recursive AST visitor is visiting the children of these expression
nodes.
llvm-svn: 123198
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
function class template.
llvm-svn: 123024
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
corresponding template parameter, make sure that prior converted
template arguments are available for substitution.
llvm-svn: 122902
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
parameters and template template parameters.
llvm-svn: 122875
|
|
|
|
|
|
|
| |
template<template<class> class ...Metafunctions>
struct apply_to_each;
llvm-svn: 122874
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
argument packs when finishing template argument deduction for a function template
llvm-svn: 122843
|
|
|
|
|
|
|
| |
non-type template parameter pack, make sure to create a pack expansion
for the corresponding template argument.
llvm-svn: 122799
|
|
|
|
|
|
|
| |
initialize those lovely mixins that come from pack expansions of base
specifiers.
llvm-svn: 122793
|
|
|
|
| |
llvm-svn: 122782
|
|
|
|
| |
llvm-svn: 122780
|
|
|
|
|
|
|
| |
argument. As part of this, be more careful when determining if there
are any parameter packs that cannot be expanded.
llvm-svn: 122776
|
|
|
|
|
|
|
| |
a class template partial specialiation, and look through pack
expansions when checking the conditions of C++0x [temp.class.spec]p8.
llvm-svn: 122774
|
|
|
|
|
|
| |
template partial specialization arguments.
llvm-svn: 122769
|
|
|
|
|
|
| |
expression lists.
llvm-svn: 122764
|
|
|
|
| |
llvm-svn: 122752
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
file
llvm-svn: 122748
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
being friends
llvm-svn: 122335
|
|
|
|
|
|
| |
in an exception specification.
llvm-svn: 122297
|
|
|
|
|
|
|
| |
specifications. We can't yet instantiate them, however, since I
tripped over PR8835.
llvm-svn: 122292
|
|
|
|
|
|
| |
in a nested-name-specifier
llvm-svn: 122282
|
|
|
|
|
|
| |
getting extra "<>" delimiters around template argument packs.
llvm-svn: 122280
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
occur within statements. Teach Sema::ActOnExceptionDeclarator() to
check for unexpanded parameter packs in the exception type.
llvm-svn: 121984
|
|
|
|
| |
llvm-svn: 121964
|
|
|
|
| |
llvm-svn: 121962
|
|
|
|
| |
llvm-svn: 121938
|
|
|
|
| |
llvm-svn: 121934
|
|
|
|
|
|
|
| |
drive-by, make sure to check for unexpanded parameter packs within the
name of a declaration.
llvm-svn: 121930
|
|
|
|
| |
llvm-svn: 121928
|
|
|
|
| |
llvm-svn: 121922
|
|
|
|
|
|
|
|
| |
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
|