summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/stmt.stmt/stmt.select
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the way we handle diagnosing unused expression results.Aaron Ballman2019-01-041-5/+4
| | | | | | | | Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. llvm-svn: 350404
* [C++17] Allow an empty expression in an if init statementZhihao Yuan2018-03-171-1/+59
| | | | | | | | | | | | | | | | | | | Summary: This fixes [PR35381](https://llvm.org/pr35381) and an additional bug where clang didn't warn about the C++17 extension when having an expression in the init statement. Thanks Nicolas Lesser for contributing the patch. Reviewers: rsmith Reviewed By: rsmith Subscribers: erik.pilkington, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D40445 llvm-svn: 327782
* Try contextually converting condition of constexpr if to Boolean valueIsmail Pazarbasi2016-09-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: C++1z 6.4.1/p2: If the if statement is of the form if constexpr, the value of the condition shall be a contextually converted constant expression of type bool [...] C++1z 5.20/p4: [...] A contextually converted constant expression of type bool is an expression, contextually converted to bool (Clause4), where the converted expression is a constant expression and the conversion sequence contains only the conversions above. [...] Contextually converting result of an expression `e` to a Boolean value requires `bool t(e)` to be well-formed. An explicit conversion function is only considered as a user-defined conversion for direct-initialization, which is essentially what //contextually converted to bool// requires. Also, fixes PR28470. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24158 llvm-svn: 280838
* Implement p0292r2 (constexpr if), a likely C++1z feature.Richard Smith2016-06-231-0/+137
| | | | llvm-svn: 273602
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-2/+2
| | | | | | | | | 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
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-191-0/+1
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-181-0/+39
| | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. llvm-svn: 148439
* add missing newlines at end of file.Chris Lattner2010-12-211-1/+1
| | | | llvm-svn: 122309
* change Scope::WithinElse to be a normal scope flag, widen theChris Lattner2010-04-121-0/+8
| | | | | | fields to two 16-bit values instead of using bitfields. llvm-svn: 101020
* Add a test for C++ [stmt.select]p3, which specifies that redeclaring aDouglas Gregor2010-03-301-0/+11
name in the outermost block of a if/else that declares the same name is ill-formed. Turns out that Clang and MSVC were right about PR6739; GCC is too lax. llvm-svn: 99937
OpenPOWER on IntegriCloud