I'm not completely sure this is the right way to fix this issue, but it seems
reasonable, and it's consistent with the non-template code for this
construct.
llvm-svn: 73285
specialization's arguments are identical to the implicit template
arguments of the primary template. Typically, this is meant to be a
declaration/definition of the primary template, so we give that
advice.
llvm-svn: 73259
partial specialization, substitute those template arguments back into
the template arguments of the class template partial specialization to
see if the results still match the original template arguments.
This code is more general than it needs to be, since we don't yet
diagnose C++ [temp.class.spec]p9. However, it's likely to be needed
for function templates.
llvm-svn: 73196
(Actually, this isn't precisely correct, but it doesn't make
sense to query whether an expression that isn't an ICE is
value-dependent anyway.)
llvm-svn: 73179
specialization types. As the example shows, we can now compute the
length of a type-list using a template metaprogram and class template
partial specialization.
llvm-svn: 73136
- Once we have deduced template arguments for a class template partial
specialization, we use exactly those template arguments for instantiating
the definition of the class template partial specialization.
- Added template argument deduction for non-type template parameters.
- Added template argument deduction for dependently-sized array types.
With these changes, we can now implement, e.g., the remove_reference
type trait. Also, Daniel's Ackermann template metaprogram now compiles
properly.
llvm-svn: 72909
deductions of the same template parameter are equivalent. This allows
us to implement the is_same type trait (!).
Also, move template argument deduction into its own file and update a
few build systems with this change (grrrr).
llvm-svn: 72819
we have the basics of declaring and storing class template partial
specializations, matching class template partial specializations at
instantiation time via (limited) template argument deduction, and
using the class template partial specialization's pattern for
instantiation.
This patch is enough to make a simple is_pointer type trait work, but
not much else.
llvm-svn: 72662
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.
llvm-svn: 72590
instantiation of tags local to member functions of class templates
(and, eventually, function templates) works when the tag is defined as
part of the decl-specifier-seq, e.g.,
struct S { T x, y; } s1;
Also, make sure that we don't try to default-initialize a dependent
type.
llvm-svn: 72568
given DeclContext is dependent on type parameters. Use this to
properly determine whether a TagDecl is dependent; previously, we were
missing the case where the TagDecl is a local class of a member
function of a class template (phew!).
Also, make sure that, when we instantiate declarations within a member
function of a class template (or a function template, eventually),
that we add those declarations to the "instantiated locals" map so
that they can be found when instantiating declaration references.
Unfortunately, I was not able to write a useful test for this change,
although the assert() that fires when uncommenting the FIXME'd line in
test/SemaTemplate/instantiate-declref.cpp tells the "experienced user"
that we're now doing the right thing.
llvm-svn: 72526
parser. Rather than placing all of the delayed member function
declarations and inline definitions into a single bucket corresponding
to the top-level class, we instead mirror the nesting structure of the
nested classes and place the delayed member functions into their
appropriate place. Then, when we actually parse the delayed member
function declarations, set up the scope stack the same way as it was
when we originally saw the declaration, so that we can find, e.g.,
template parameters that are in scope.
llvm-svn: 72502
declaration references. The key realization is that dependent Decls,
which actually require instantiation, can only refer to the current
instantiation or members thereof. And, since the current context
during instantiation contains all of those members of the current
instantiation, we can simply find the real instantiate that matches up
with the "current instantiation" template.
llvm-svn: 72486
within a template now have a link back to the enumeration from which
they were instantiated. This means that we can now find the
instantiation of an anonymous enumeration.
llvm-svn: 72482
references. There are several smallish fixes here:
- Make sure we look through template parameter scope when
determining whether we're parsing a nested class (or nested class
*template*). This makes sure that we delay parsing the bodies of
inline member functions until after we're out of the outermost
class (template) scope.
- Since the bodies of member functions are always parsed
"out-of-line", even when they were declared in-line, teach
unqualified name lookup to look into the (semantic) parents.
- Use the new InstantiateDeclRef to handle the instantiation of a
reference to a declaration (in DeclRefExpr), which drastically
simplifies template instantiation for DeclRefExprs.
- When we're instantiating a ParmVarDecl, it must be in the current
instantiation scope, so only look there.
Also, remove the #if 0's and FIXME's from the dynarray example, which
now compiles and executes thanks to Anders and Eli.
llvm-svn: 72481
instantiation of a declaration from the template version (or version
that lives in a template) and a given set of template arguments. This
needs much, much more testing, but it suffices for simple examples
like
typedef T* iterator;
iterator begin();
llvm-svn: 72461