summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-init.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Handle use of default member initializers before end of outermost classReid Kleckner2014-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, when we have this situation: struct A { template <typename T> struct B { int m1 = sizeof(A); }; B<int> m2; }; We can't parse m1's initializer eagerly because we need A to be complete. Therefore we wait until the end of A's class scope to parse it. However, we can trigger instantiation of B before the end of A, which will attempt to instantiate the field decls eagerly, and it would build a bad field decl instantiation that said it had an initializer but actually lacked one. Fixed by deferring instantiation of default member initializers until they are needed during constructor analysis. This addresses a long standing FIXME in the code. Fixes PR19195. Reviewed By: rsmith Differential Revision: http://reviews.llvm.org/D5690 llvm-svn: 222192
* Return statements are initialization; don't forget to revert the initializer toRichard Smith2014-08-211-0/+9
| | | | | | its syntactic form before re-analyzing it during template instantiation. llvm-svn: 216224
* Properly track l-paren of a CXXFucntionalCastExpr.Eli Friedman2013-08-151-0/+15
| | | | | | | | | | In addition to storing more useful information in the AST, this fixes a semantic check in template instantiation which checks whether the l-paren location is valid. Fixes PR16903. llvm-svn: 188495
* Improve 'failed template argument deduction' diagnostic for the case where weRichard Smith2013-01-311-1/+1
| | | | | | | | have a direct mismatch between some component of the template and some component of the argument. The diagnostic now says what the mismatch was, but doesn't yet say which part of the template doesn't match. llvm-svn: 174039
* Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,Eli Friedman2012-12-131-1/+1
| | | | | | and make sure additional uses don't get introduced. <rdar://problem/12858424>. llvm-svn: 170081
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-101-2/+13
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* Improve the instantiation of static data members inDouglas Gregor2011-06-031-4/+15
| | | | | | | Sema::RequireCompleteExprType() a bit more, setting the point of instantiation if needed, and skipping explicit specializations entirely. llvm-svn: 132547
* When performing template argument deduction given a function argumentDouglas Gregor2011-06-031-0/+23
| | | | | | | | | of incomplete array type, attempt to complete the array type. This was made much easier by Chandler's addition of RequireCompleteExprType(), which I've tweaked (slightly) to improve the consistency of the DeclRefExpr. Fixes PR7985. llvm-svn: 132530
* Enhance Clang to start instantiating static data member definitionsChandler Carruth2011-05-271-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | within class templates when they are necessary to complete the type of the member. The canonical example is code like: template <typename T> struct S { static const int arr[]; static const int x; static int f(); }; template <typename T> const int S<T>::arr[] = { 1, 2, 3 }; template <typename T> const int S<T>::x = sizeof(arr) / sizeof(arr[0]); template <typename T> int S<T>::f() { return x; } int x = S<int>::f(); We need to instantiate S<T>::arr's definition to pick up its initializer and complete the array type. This involves new code to specially handle completing the type of an expression where the type alone is insufficient. It also requires *updating* the expression with the newly completed type. Fortunately, all the other infrastructure is already in Clang to do the instantiation, do the completion, and prune out the unused bits of code that result from this instantiation. This addresses the initial bug in PR10001, and will be a step to fleshing out other cases where we need to work harder to complete an expression's type. Who knew we still had missing C++03 "features"? llvm-svn: 132172
* When pulling apart an initializer that involves a CXXConstructExpr, doDouglas Gregor2010-03-241-0/+18
| | | | | | | not pick apart a CXXTemporaryObjectExpr because such an object construction was explicitly written in the source code. Fixes PR6657. llvm-svn: 99427
* Use CXXTemporaryObjectExpr for explicitly-constructed temporaries. WeDouglas Gregor2010-03-021-0/+11
| | | | | | | used to do this, but it got lost when we switched functional-style cast syntax over to using the new initialization code. Fixes PR6457. llvm-svn: 97568
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Implement support for C++ direct initializers that involve dependentDouglas Gregor2009-08-261-0/+28
types or type-dependent expressions. llvm-svn: 80143
OpenPOWER on IntegriCloud