summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/constant-expression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR31701: Fix crash on invalid caused by parsing a dependent initializer when weRichard Smith2017-01-201-0/+11
| | | | | | don't know we're in a dependent context. llvm-svn: 292561
* Don't assert if evaluation of an expression that we're syntactically requiredRichard Smith2015-12-041-0/+2
| | | | | | | to treat as an ICE results in undefined behavior. Instead, return the "natural" result of the operation (signed wraparound / inf / nan). llvm-svn: 254699
* [Sema] Fix assertion hit while trying to do constant evaluation for a ↵Argyrios Kyrtzidis2014-02-151-0/+8
| | | | | | | | | | dependent expression inside a GNU statement expression. rdar://16064952 llvm-svn: 201468
* PR18283: If a const variable of integral or enumeration type isRichard Smith2014-01-251-0/+9
| | | | | | | | initialized from a constant expression in C++98, it can be used in constant expressions, even if it was brace-initialized. Patch by Rahul Jain! llvm-svn: 200098
* Change the wording of the extension warning fromDmitri Gribenko2012-09-241-1/+1
| | | | | | | | | > 'long long' is an extension when C99 mode is not enabled to > 'long long' is a C++11 extension while compiling in C++98 mode. llvm-svn: 164545
* Fix test so it works the same way on 32-bit and 64-bit.Eli Friedman2012-07-181-1/+1
| | | | llvm-svn: 160415
* Don't treat overflow in floating-point conversions as a hard error in ↵Eli Friedman2012-07-171-1/+1
| | | | | | constant evaluation. <rdar://problem/11874571>. llvm-svn: 160394
* Fix a crash-on-invalid where the constant evaluator would try toJohn McCall2012-04-261-0/+7
| | | | | | evaluate certain expressions involving invalidly-defined classes. llvm-svn: 155645
* Pedantic diagnostic correction: in C++, we have integral constant expressions,Richard Smith2012-01-151-4/+4
| | | | | | | | not integer constant expressions. In passing, fix the 'folding is an extension' diagnostic to not claim we're accepting the code, since that's not true in -pedantic-errors mode, and add this diagnostic to -Wgnu. llvm-svn: 148209
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-191-2/+11
| | | | | | | | | | | | | | | | | | | | | variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
* PR11604: don't allow floating-literal-to-integer casts in ICEs if the ↵Richard Smith2011-12-181-0/+6
| | | | | | | | | | (truncated) floating literal value does not fit into the destination type. Such casts have undefined behavior at translation time; treating them as non-ICE matches the behavior of modern gcc versions. llvm-svn: 146842
* Fix a cluster of related issues involving value-dependence and constantRichard Smith2011-11-081-0/+7
| | | | | | | | | | | | | | expression evaluation: - When folding a non-value-dependent expression, we may try to use the initializer of a value-dependent variable. If that happens, give up. - In C++98, actually check that a const, non-volatile DeclRefExpr inside an ICE is of integral or enumeration type (a reference isn't OK!) - In C++11, DeclRefExprs for objects of const literal type initialized with value-dependent expressions are themselves value-dependent. - So are references initialized with value-dependent expressions (though this case is missing from the C++11 standard, along with many others). llvm-svn: 144056
* Split apart the state accumulated during constant expression evaluation and theRichard Smith2011-10-161-0/+10
| | | | | | | end result. Use this split to propagate state information and diagnostics through more of constant expression evaluation. llvm-svn: 142159
* If a switch condition is constant, don't warn about missing enum cases.John McCall2010-05-181-2/+2
| | | | | | | | If a switch condition is constant, warn if there's no case for it. Constant switch conditions do come up in reasonable template code. llvm-svn: 104010
* Fix a few cases where enum constant handling was usingDouglas Gregor2010-04-151-3/+7
| | | | | | | | | | ASTContext::getTypeSize() rather than ASTContext::getIntWidth() for the width of an integral type. The former includes padding for bools (to the target's size) while the latter does not, so we woud end up zero-extending bools to the target width when we shouldn't. Fixes a crash-on-valid in the included test. llvm-svn: 101372
* 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
* Add a big test case for I-C-Es in C++, and a fix to make it work. The fix ↵Sebastian Redl2009-05-271-0/+83
might not be the right way to do it. llvm-svn: 72490
OpenPOWER on IntegriCloud