summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-expr-4.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Check for qualified function types after substituting into the operandRichard Smith2019-10-031-0/+9
| | | | | | | | | | of 'typeid'. This is a rare place where it's valid for a function type to be substituted but not valid for a qualified function type to be substituted, so needs a special check. llvm-svn: 373648
* [Sema] Deduplicate some availability checking logicErik Pilkington2019-03-201-2/+2
| | | | | | | | | | | | | | | Before this commit, we emit unavailable errors for calls to functions during overload resolution, and for references to all other declarations in DiagnoseUseOfDecl. The early checks during overload resolution aren't as good as the DiagnoseAvailabilityOfDecl based checks, as they error on the code from PR40991. This commit fixes this by removing the early checking. llvm.org/PR40991 rdar://48564179 Differential revision: https://reviews.llvm.org/D59394 llvm-svn: 356599
* Lit C++11 Compatibility Patch #7Charles Li2016-04-131-0/+12
| | | | | | | 13 tests have been updated for C++11 compatibility. Differential Revision: http://reviews.llvm.org/D19068 llvm-svn: 266239
* Fix crash due to missing array-to-pointer decay when instantiating an unresolvedRichard Smith2011-10-261-0/+10
| | | | | | member expression. Refactoring to follow. llvm-svn: 143017
* When we decide not to rebuild an instantiated C++ 'new' expressionDouglas Gregor2011-07-261-0/+17
| | | | | | | | that allocates an array of objects with a non-trivial destructor, be sure to mark the destructor is "used". Fixes PR10480 / <rdar://problem/9834317>. llvm-svn: 136081
* Add -fcxx-exceptions to all tests that use C++ exceptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126599
* Pass -fexceptions to all tests that use try/catch/throw.Anders Carlsson2011-02-191-1/+1
| | | | llvm-svn: 126037
* Enhance the diagnostic for negative array sizes to include theChandler Carruth2011-01-041-2/+2
| | | | | | | | | | | declaration name of the array when present. This ensures that a poor-man's C++03 static_assert will include the user error message often embedded in the name. Update all the tests to reflect the new wording, and add a test for the name behavior. llvm-svn: 122802
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Continue to instantiate sub-statements in a CompoundStmt as long asJohn McCall2010-08-271-1/+1
| | | | | | | we don't see a DeclStmt (failure to instantiate which generally causes panic). llvm-svn: 112282
* Re-bind non-dependent CXXTemporaryObjectExpr nodes as temporaries whenChandler Carruth2010-03-311-0/+13
| | | | | | | instantiating a template, which ensures the destructor is called. This fixes PR6671. llvm-svn: 100029
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-1/+1
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Migrate the mish-mash of declaration checks inDouglas Gregor2010-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::ActOnUninitializedDecl over to InitializationSequence (with default initialization), eliminating redundancy. More importantly, we now check that a const definition in C++ has an initilizer, which was an #if 0'd code for many, many months. A few other tweaks were needed to get everything working again: - Fix all of the places in the testsuite where we defined const objects without initializers (now that we diagnose this issue) - Teach instantiation of static data members to find the previous declaration, so that we build proper redeclaration chains. Previously, we had the redeclaration chain but built it too late to be useful, because... - Teach instantiation of static data member definitions not to try to check an initializer if a previous declaration already had an initializer. This makes sure that we don't complain about static const data members with in-class initializers and out-of-line definitions. - Move all of the incomplete-type checking logic out of Sema::FinalizeDeclaratorGroup; it makes more sense in ActOnUnitializedDecl. There may still be a few places where we can improve these diagnostics. I'll address that as a separate commit. llvm-svn: 95657
* Use the new init code for member subobjects.Anders Carlsson2010-01-231-1/+1
| | | | llvm-svn: 94329
* Improve the reporting of non-viable overload candidates by noting the reasonJohn McCall2010-01-131-1/+1
| | | | | | | | why the candidate is non-viable. There's a lot we can do to improve this, but it's a good start. Further improvements should probably be integrated with the bad-initialization reporting routines. llvm-svn: 93277
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-061-2/+2
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Diagnose the use of incomplete types in C++ typeid expressionsDouglas Gregor2009-12-231-4/+3
| | | | llvm-svn: 92045
* When transforming a C++ "new" expression that was not explicitly givenDouglas Gregor2009-12-221-0/+14
| | | | | | | a size, check whether the transformed type is itself an array type. If so, take the major array bound as the size to allocate. Fixes PR5833. llvm-svn: 91907
* Switch the initialization required by return statements over to theDouglas Gregor2009-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | new InitializationSequence. This fixes some bugs (e.g., PR5808), changed some diagnostics, and caused more churn than expected. What's new: - InitializationSequence now has a "C conversion sequence" category and step kind, which falls back to - Changed the diagnostics for returns to always have the result type of the function first and the type of the expression second. CheckSingleAssignmentConstraints to peform checking in C. - Improved ASTs for initialization of return values. The ASTs now capture all of the temporaries we need to create, but intentionally do not bind the tempoary that is actually returned, so that it won't get destroyed twice. - Make sure to perform an (elidable!) copy of the class object that is returned from a class. - Fix copy elision in CodeGen to properly see through the subexpressions that occur with elidable copies. - Give "new" its own entity kind; as with return values and thrown objects, we don't bind the expression so we don't call a destructor for it. Note that, with this patch, I've broken returning move-only types in C++0x. We'll fix it later, when we tackle NRVO. llvm-svn: 91669
* Switch the C++ new expression over to InitializationSequence, ratherDouglas Gregor2009-12-161-2/+2
| | | | | | | | | | | | | | | | | | | | | than using its own partial implementation of initialization. Switched CheckInitializerTypes over to InitializedEntity/InitializationKind, to help move us closer to InitializationSequence. Added InitializedEntity::getName() to retrieve the name of the entity, for diagnostics that care about such things. Implemented support for default initialization in InitializationSequence. Clean up the determination of the "source expressions" for an initialization sequence in InitializationSequence::Perform. Taught CXXConstructExpr to store more location information. llvm-svn: 91492
* 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
* Rework the way we handle template instantiation forDouglas Gregor2009-12-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | implicitly-generated AST nodes. We previously built instantiated nodes for each of these AST nodes, then passed them on to Sema, which was not prepared to see already-type-checked nodes (see PR5755). In some places, we had ugly workarounds to try to avoid re-type-checking (e.g., in VarDecl initializer instantiation). Now, we skip implicitly-generated nodes when performing instantiation, preferring instead to build just the AST nodes that directly reflect what was written in the source code. This has several advantages: - We don't need to instantiate anything that doesn't have a direct correlation to the source code, so we can have better location information. - Semantic analysis sees the same thing at template instantiation time that it would see for a non-template. - At least one ugly hack (VarDecl initializers) goes away. Fixes PR5755. llvm-svn: 91218
* Reimplement reference initialization (C++ [dcl.init.ref]) using theDouglas Gregor2009-12-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new notion of an "initialization sequence", which encapsulates the computation of the initialization sequence along with diagnostic information and the capability to turn the computed sequence into an expression. At present, I've only switched one CheckReferenceInit callers over to this new mechanism; more will follow. Aside from (hopefully) being much more true to the standard, the diagnostics provided by this reference-initialization code are a bit better than before. Some examples: p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct Derived' cannot bind to a value of unrelated type 'struct Base' Derived &dr2 = b; // expected-error{{non-const lvalue reference to ... ^ ~ p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to a value of type 'struct Base const' drops qualifiers Base &br3 = bc; // expected-error{{drops qualifiers}} ^ ~~ p5-var.cpp:57:15: error: ambiguous conversion from derived class 'struct Diamond' to base class 'struct Base': struct Diamond -> struct Derived -> struct Base struct Diamond -> struct Derived2 -> struct Base Base &br5 = diamond; // expected-error{{ambiguous conversion from ... ^~~~~~~ p5-var.cpp:59:9: error: non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int' long &lr = i; // expected-error{{non-const lvalue reference to type ... ^ ~ p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Base' Base &br1 = Base(); // expected-error{{non-const lvalue reference to ... ^ ~~~~~~ p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field 'i' int & ir1 = (ib.i); // expected-error{{non-const reference cannot ... ^ ~~~~~~ p5-var.cpp:98:7: note: bit-field is declared here int i : 17; // expected-note{{bit-field is declared here}} ^ llvm-svn: 90992
* Template instantiation for qualified declaration referenceDouglas Gregor2009-05-221-0/+11
| | | | | | | | | | | | | | | | | | expressions. We are now missing template instantiation logic for only three classes of expressions: - Blocks-related expressions (BlockExpr, BlockDeclRefExpr) - C++ default argument expressions - Objective-C expressions Additionally, our handling of DeclRefExpr is still quite poor, since it cannot handle references to many kinds of declarations. As part of this change, converted the TemplateExprInstantiator to use iteration through all of the expressions via clang/AST/StmtNodes.def, ensuring that we don't forget to add template instantiation logic for any new expression node kinds. llvm-svn: 72303
* Add a few tests to ensure that member functions of class templates canDouglas Gregor2009-05-221-0/+38
| | | | | | | call other member functions of class templates, including after template instantiation. No functionality change. llvm-svn: 72282
* Representation of and template instantiation for memberDouglas Gregor2009-05-221-0/+60
| | | | | | | | | | | | expressions. This change introduces another AST node, CXXUnresolvedMemberExpr, that captures member references (x->m, x.m) when the base of the expression (the "x") is type-dependent, and we therefore cannot resolve the member reference yet. Note that our parsing of member references for C++ is still quite poor, e.g., we don't handle x->Base::m or x->operator int. llvm-svn: 72281
* Template instantiation for initializer listsDouglas Gregor2009-05-211-0/+28
| | | | llvm-svn: 72229
* Template instantiation for unary type traits, e.g., __is_podDouglas Gregor2009-05-211-0/+11
| | | | llvm-svn: 72220
* Template instantiation for C++ "typeid" expressions.Douglas Gregor2009-05-211-0/+26
| | | | llvm-svn: 72218
* Template instantiation for C++ throw expressionsDouglas Gregor2009-05-211-0/+18
| | | | llvm-svn: 72217
* Template instantiation for C++ delete expressionDouglas Gregor2009-05-211-1/+13
| | | | llvm-svn: 72216
* Template instantiation for C++ "new" expressions.Douglas Gregor2009-05-211-2/+43
| | | | llvm-svn: 72199
* Template instantiation for CXXExprWithTemporaries, which occurs whenDouglas Gregor2009-05-201-0/+9
| | | | | | | | | | temporaries are generated for some object-constructing expressions in templates that are not type-dependent. Also, be sure to introduce the variable from a CXXConditionDeclExpr into the set of instantiated local variables. llvm-svn: 72185
* Template instantiation for the various kinds of AST nodes that occurDouglas Gregor2009-05-201-0/+35
due to C++ type construction of the form T(a1, a2, ..., aN). llvm-svn: 72183
OpenPOWER on IntegriCloud