summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr
Commit message (Collapse)AuthorAgeFilesLines
...
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-214-13/+13
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* DR974: Lambdas can have default arguments.Richard Smith2013-04-172-6/+4
| | | | llvm-svn: 179688
* <rdar://problem/13473493> Handle 'this->' insertion recovery within trailing ↵Douglas Gregor2013-03-261-0/+20
| | | | | | return types. llvm-svn: 178081
* PR15290: 'this' is not permitted in the declaration of a friend function,Richard Smith2013-03-151-0/+17
| | | | | | | therefore references to members should not be transformed into implicit uses of 'this'. Patch by Ismail Pazarbasi! llvm-svn: 177134
* Don't crash while printing APValues that are lvalues casted to aDouglas Gregor2013-01-291-0/+13
| | | | | | decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>. llvm-svn: 173747
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-172-3/+5
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Improve diagnostic wording for when an implicitly-deleted special memberRichard Smith2012-12-281-1/+1
| | | | | | function is selected by overload resolution. llvm-svn: 171190
* Test that we correctly deal with multiple copy constructors when detectingRichard Smith2012-11-221-2/+13
| | | | | | non-trivial special members for varargs calls. llvm-svn: 168476
* Teach Clang parser to reject C++11 attributes that appertain to declaration ↵Michael Han2012-11-061-4/+4
| | | | | | | | | specifiers. We don't support any C++11 attributes that appertain to declaration specifiers so reject the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing. llvm-svn: 167481
* When capturing 'this' in a lambda, make sure to update the set ofDouglas Gregor2012-10-251-0/+15
| | | | | | | array-index starting values for the 'this' capture. Fixes <rdar://problem/12426831>. llvm-svn: 166709
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-1915-0/+15
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Fix directive parsing in VerifyDiagnosticConsumer so that it ensures that ↵Andy Gibbs2012-10-191-2/+2
| | | | | | | | "expected" is at the start of the word and will no longer accept typos such as "junkexpected-*" as a valid "expected-*" directive. A very few test-cases had to be amended to adhere to the new rule. Patch reviewed by David Blaikie. llvm-svn: 166279
* Revert r163829. The world (or libstdc++, at least) is not ready.Richard Smith2012-09-131-6/+5
| | | | llvm-svn: 163846
* Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.Richard Smith2012-09-131-5/+6
| | | | llvm-svn: 163829
* PR12057: Allow variadic template pack expansions to cross lambda boundaries.Richard Smith2012-07-252-3/+20
| | | | | | | | | | Rather than adding a ContainsUnexpandedParameterPack bit to essentially every AST node, we tunnel the bit directly up to the surrounding lambda expression when we reach a context where an unexpanded pack can not normally appear. Thus any statement or declaration within a lambda can now potentially contain an unexpanded parameter pack. llvm-svn: 160705
* Don't treat overflow in floating-point conversions as a hard error in ↵Eli Friedman2012-07-171-3/+3
| | | | | | constant evaluation. <rdar://problem/11874571>. llvm-svn: 160394
* block literal irgen: several improvements on naming blockFariborz Jahanian2012-06-261-3/+3
| | | | | | | | | | | | literal helper functions. All helper functions (global and locals) use block_invoke as their prefix. Local literal helper names are prefixed by their enclosing mangled function names. Blocks in non-local initializers (e.g. a global variable or a C++11 field) are prefixed by their mangled variable name. The descriminator number added to end of the name starts off with blank (for first block) and _<N> (for the N+2-th block). llvm-svn: 159206
* Check the parameter lists and return type of both blocks and lambdasDouglas Gregor2012-06-151-0/+21
| | | | | | | for unexpanded parameter packs. Fixes the crash-on-invalid in PR13117. llvm-svn: 158525
* Fixes some test cases that should have come along with r157943.Aaron Ballman2012-06-041-4/+4
| | | | llvm-svn: 157947
* Implement the C++11 discarded value expression rules for volatile lvalues. ↵Eli Friedman2012-05-241-0/+46
| | | | | | <rdar://problem/10790820>. llvm-svn: 157420
* Clean up r156925, so that we only mark the capturing DeclRefExpr of aDouglas Gregor2012-05-162-22/+29
| | | | | | | | | lambda as referring to a local in an enclosing scope if we're in the enclosing scope of the lambda (not it's function call operator). Also, turn the test into an IR generation test, since that's where the crashes occurred. Really fixes PR12746 / <rdar://problem/11465120>. llvm-svn: 156926
* Fix code generation of variables reference expressions when mixingDouglas Gregor2012-05-161-0/+22
| | | | | | | blocks and lambdas, based heavily on a patch from Meador Inge. Fixes PR12746 / <rdar://problem/11465120>. llvm-svn: 156925
* Improve some of the conversion warnings to fire on conversion to bool.David Blaikie2012-05-151-1/+1
| | | | | | | | | | | Moves the bool bail-out down a little in SemaChecking - so now -Wnull-conversion and -Wliteral-conversion can fire when the target type is bool. Also improve the wording/details in the -Wliteral-conversion warning to match the -Wconstant-conversion. llvm-svn: 156826
* Disable our non-standard delayed parsing of exception specifications. DelayingRichard Smith2012-05-021-2/+3
| | | | | | | the parsing of such things appears to be a conforming extension, but it breaks libstdc++4.7's std::pair. llvm-svn: 155975
* PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue referenceRichard Smith2012-04-291-2/+5
| | | | | | type. But a glvalue can be reinterpret_cast to either flavor of reference. llvm-svn: 155789
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-0/+10
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-0/+90
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Improve diagnostics for invalid use of non-static members / this:Richard Smith2012-04-053-4/+4
| | | | | | | | | | | | * s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted the former by 28-2 in our diagnostics. * Fix the "use of member in static member function" diagnostic to correctly detect this situation inside a block or lambda. * Produce a more specific "invalid use of non-static member" diagnostic for the case where a nested class member refers to a member of a lexically-surrounding class. llvm-svn: 154073
* Extend -Wc++11-narrowing to cover converted constant expressions as well as ↵Eli Friedman2012-03-291-0/+8
| | | | | | braced-initializers. <rdar://problem/11121178>. llvm-svn: 153703
* Fix crash & accepts-invalid for array of arrays of user defined type.David Blaikie2012-03-102-0/+30
| | | | | | | Test case/other help by Richard Smith. Code review by John McCall. llvm-svn: 152519
* Ensure that we instantiate static reference data members of class templatesRichard Smith2012-03-021-2/+2
| | | | | | | | | early, since their values can be used in constant expressions in C++11. For odr-use checking, the opposite change is required, since references are odr-used whether or not they satisfy the requirements for appearing in a constant expression. llvm-svn: 151881
* Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. AlsoRichard Smith2012-03-011-3/+6
| | | | | | | improve the diagnostics for some attempts to use initializer lists in expressions. llvm-svn: 151794
* Make the odr-use logic work correctly for constant-expressions. PR12006.Eli Friedman2012-02-291-3/+2
| | | | llvm-svn: 151699
* Convert initializer lists to temporaries in CreateBuiltinBinOp. Allows ↵Sebastian Redl2012-02-271-3/+2
| | | | | | assignment of init lists to built-in types and resolves PR12088. llvm-svn: 151551
* Tests for r151508.Richard Smith2012-02-261-0/+32
| | | | llvm-svn: 151509
* PR11956: C++11's special exception for accessing non-static data members fromRichard Smith2012-02-251-1/+9
| | | | | | unevaluated operands applies within member functions, too. llvm-svn: 151443
* Teach overload resolution to prefer user-defined conversion via aDouglas Gregor2012-02-221-0/+31
| | | | | | | | | | lambda closure type's function pointer conversion over user-defined conversion via a lambda closure type's block pointer conversion, always. This is a preference for more-standard code (since blocks are an extension) and a nod to efficiency, since function pointers don't require any memory management. Fixes PR12063. llvm-svn: 151170
* Generate an AST for the conversion from a lambda closure type to aDouglas Gregor2012-02-221-0/+0
| | | | | | | | | | | | | | | block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. llvm-svn: 151131
* In the conflict between C++11 [expr.prim.general]p4, which declaresDouglas Gregor2012-02-211-0/+11
| | | | | | | | | | | that 'this' can be used in the brace-or-equal-initializer of a non-static data member, and C++11 [expr.prim.lambda]p9, which says that lambda expressions not in block scope can have no captures, side fully with C++11 [expr.prim.general]p4 by allowing 'this' to be captured within these initializers. This seems to be the intent of non-static data member initializers. llvm-svn: 151101
* Improve our handling of lambda expressions that occur within defaultDouglas Gregor2012-02-211-0/+6
| | | | | | | | | | | | | | | | | | | arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. llvm-svn: 151076
* Rewrite variable capture within lambda expressions and blocks,Douglas Gregor2012-02-183-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eliminating a bunch of redundant code and properly modeling how the captures of outside blocks/lambdas affect the types seen by inner captures. This new scheme makes two passes over the capturing scope stack. The first pass goes up the stack (from innermost to outermost), assessing whether the capture looks feasible and stopping when it either hits the scope where the variable is declared or when it finds an existing capture. The second pass then walks down the stack (from outermost to innermost), capturing the variable at each step and updating the captured type and the type that an expression referring to that captured variable would see. It also checks type-specific restrictions, such as the inability to capture an array within a block. Note that only the first odr-use of each variable needs to do the full walk; subsequent uses will find the capture immediately, so multiple walks need not occur. The same routine that builds the captures can also compute the type of the captures without signaling errors and without actually performing the capture. This functionality is used to determine the type of declaration references as well as implementing the weird decltype((x)) rule within lambda expressions. The capture code now explicitly takes sides in the debate over C++ core issue 1249, which concerns the type of captures within nested lambdas. We opt to use the more permissive, more useful definition implemented by GCC rather than the one implemented by EDG. llvm-svn: 150875
* Unify our computation of the type of a captured reference to aDouglas Gregor2012-02-182-2/+5
| | | | | | | variable; it was previously duplicated, and one of the copies failed to account for outer non-mutable lambda captures. llvm-svn: 150872
* Only add 'const' to the type of variables captured in a lambda whenDouglas Gregor2012-02-171-0/+4
| | | | | | we're capturing it by value in a non-mutable lambda. llvm-svn: 150791
* Lambda closure types are always considered to be like "local" classes,Douglas Gregor2012-02-161-0/+33
| | | | | | | | | even if they are not within a function scope. Teach template instantiation to treat them as such, and make sure that we have a local instantiation scope when instantiating default arguments and static data members. llvm-svn: 150725
* Implicitly define a lambda's conversion functions (to functionDouglas Gregor2012-02-161-0/+20
| | | | | | | | | | | | | pointers and block pointers). We use dummy definitions to keep the invariant that an implicit, used definition has a body; IR generation will substitute the actual contents, since they can't be represented as C++. For the block pointer case, compute the copy-initialization needed to capture the lambda object in the block, which IR generation will need later. llvm-svn: 150645
* Lambda closure types have a conversion function to a block pointerDouglas Gregor2012-02-151-0/+7
| | | | | | | | | | | with the same parameter types and return type as the function call operator. This is the real answer to http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block :) llvm-svn: 150620
* When overload resolution picks an implicitly-deleted special memberDouglas Gregor2012-02-151-6/+3
| | | | | | | | | function, provide a specialized diagnostic that indicates the kind of special member function (default constructor, copy assignment operator, etc.) and that it was implicitly deleted. Add a hook where we can provide more detailed information later. llvm-svn: 150611
* A little more lambda capture initialization diagnostics cleanupDouglas Gregor2012-02-151-1/+8
| | | | llvm-svn: 150589
* Introduce a new initialization entity for lambda captures, andDouglas Gregor2012-02-151-3/+6
| | | | | | specialize location information and diagnostics for this entity. llvm-svn: 150588
* Specialize noreturn diagnostics for lambda expressions.Douglas Gregor2012-02-153-3/+5
| | | | llvm-svn: 150586
OpenPOWER on IntegriCloud