summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constant-expression-cxx1y.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug where a trivial constexpr copy/move operation couldn't copy from anRichard Smith2014-11-191-0/+28
| | | | | | | empty non-constexpr object. Such a copy doesn't break any of the constexpr rules. llvm-svn: 222387
* Improve -Wuninitialized to take into account field ordering with initializerRichard Trieu2014-09-231-2/+1
| | | | | | | lists. Since the fields are inititalized one at a time, using a field with lower index to initialize a higher indexed field should not be warned on. llvm-svn: 218339
* Don't reject dependent range-based for loops in constexpr functions. The loopRichard Smith2013-11-151-0/+13
| | | | | | variable isn't really uninitialized, it's just not initialized yet. llvm-svn: 194767
* PR17615: A delegating constructor initializer is a full-expression. Don'tRichard Smith2013-11-071-0/+11
| | | | | | forget to clean up temporaries at the end of it. llvm-svn: 194213
* More constant evaluation cleanup, and fix an issue where we'd override anRichard Smith2013-11-061-3/+3
| | | | | | | earlier 'non-constant' diagnostic with a later one if the earlier one was from a side-effect we thought we could evaluate past. llvm-svn: 194117
* PR16755: When initializing or modifying a bitfield member in a constantRichard Smith2013-08-061-0/+17
| | | | | | expression, truncate the stored value to the size of the bitfield. llvm-svn: 187782
* C++1y: track object lifetime during constexpr evaluation, and don't allowRichard Smith2013-07-241-0/+56
| | | | | | | objects to be used once their lifetimes end. This completes the C++1y constexpr extensions. llvm-svn: 187025
* More of N3652: don't add an implicit 'const' to 'constexpr' member functions ↵Richard Smith2013-06-251-0/+24
| | | | | | when checking for overloads in C++1y. llvm-svn: 184865
* PR16377: Allow evaluation of statement expressions in constant evaluation,Richard Smith2013-06-201-0/+25
| | | | | | why not. Apparently GCC supports this. llvm-svn: 184396
* PR12086, PR15117Richard Smith2013-06-121-0/+40
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Model temporary lifetime-extension explicitly in the AST. Use this model toRichard Smith2013-06-051-0/+10
| | | | | | | | | handle temporaries which have been lifetime-extended to static storage duration within constant expressions. This correctly handles nested lifetime extension (through reference members of aggregates in aggregate initializers) but non-constant-expression emission hasn't yet been updated to do the same. llvm-svn: 183283
* PR16090: C++1y: treat undeduced 'auto' as a literal type, so that constexprRichard Smith2013-05-211-0/+7
| | | | | | function templates can use it as a return type. llvm-svn: 182433
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-2/+3
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* C++1y: support for 'switch' statements in constexpr functions. This is somewhatRichard Smith2013-05-121-0/+114
| | | | | | | | inefficient; we perform a linear scan of switch labels to find the one matching the condition, and then walk the body looking for that label. Both parts should be straightforward to optimize. llvm-svn: 181671
* C++1y constant expression evaluation: compound assignment support for ↵Richard Smith2013-05-071-13/+54
| | | | | | floating-point and pointer types. llvm-svn: 181376
* C++1y constant expression evaluation: support for compound assignments on ↵Richard Smith2013-05-071-3/+55
| | | | | | integers. llvm-svn: 181287
* C++1y: an assignment operator is implicitly 'constexpr' if it would only ↵Richard Smith2013-05-071-0/+43
| | | | | | call 'constexpr' assignment operators for a literal class type. llvm-svn: 181284
* C++1y: support range-based for loops in constant expressions.Richard Smith2013-05-061-0/+54
| | | | llvm-svn: 181184
* C++1y: support 'for', 'while', and 'do ... while' in constant expressions.Richard Smith2013-05-061-20/+71
| | | | llvm-svn: 181181
* C++1y: support for increment and decrement in constant expression evaluation.Richard Smith2013-05-051-7/+73
| | | | llvm-svn: 181173
* Factor out duplication between lvalue-to-rvalue conversions and variableRichard Smith2013-05-051-0/+5
| | | | | | | assignments in constant expressions. No significant functionality changes (slight improvement to potential constant expression checking). llvm-svn: 181170
* C++1y: support simple variable assignments in constexpr functions.Richard Smith2013-04-261-0/+157
| | | | llvm-svn: 180603
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-221-0/+126
statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
OpenPOWER on IntegriCloud