summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exceptions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block"Brian Gesiak2019-03-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D59076 added a new coroutine error that prevented users from using 'co_await' or 'co_yield' within a exception handler. However, it was reverted in https://reviews.llvm.org/rC356774 because it caused a regression in nested scopes in C++ catch statements, as documented by https://bugs.llvm.org/show_bug.cgi?id=41171. The issue was due to an incorrect use of a `clang::ParseScope`. To fix: 1. Add a regression test for catch statement parsing that mimics the bug report from https://bugs.llvm.org/show_bug.cgi?id=41171. 2. Re-apply the coroutines error patch from https://reviews.llvm.org/D59076, but this time with the correct ParseScope behavior. Reviewers: GorNishanov, tks2103, rsmith, riccibruno, jbulow Reviewed By: riccibruno Subscribers: EricWF, jdoerfert, lewissbaker, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59752 llvm-svn: 356865
* [Sema] Don't permit catching variably modified typesDavid Majnemer2016-06-081-0/+14
| | | | | | | | Variably modified types shouldn't be permitted in catch clauses. This fixes PR28047. llvm-svn: 272159
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-4/+19
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* Generate a diagnostic when a catch handler cannot execute due to class ↵Aaron Ballman2015-04-081-0/+76
| | | | | | hierarchy inversion with regards to other catch handlers for the same block. llvm-svn: 234375
* Sema: Caught exception objects should be unqualifiedDavid Majnemer2015-03-031-1/+20
| | | | | | | | The exception object should be unqualified. Using a qualified exception object results in the wrong copy constructor getting called when the catch handler executes. llvm-svn: 231054
* Sema: Properly initialize the thrown exception objectDavid Majnemer2015-03-031-0/+13
| | | | | | | We would create the exception object with the wrong qualifiers, ensuring that the wrong copy constructor would get called. llvm-svn: 231049
* Partial revert of r229336; this wasn't intended to go in.Aaron Ballman2015-02-151-78/+0
| | | | llvm-svn: 229338
* Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the ↵Aaron Ballman2015-02-151-0/+78
| | | | | | macro. NFC; Clang edition. llvm-svn: 229336
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-061-12/+12
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* Per C++11 [except.spec]p2, rvalue references are not permitted in exception ↵Richard Smith2012-11-281-0/+2
| | | | | | specifications. llvm-svn: 168824
* PR14388: An array or function type in an exception specification should beRichard Smith2012-11-281-0/+23
| | | | | | | decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and additional testcases by me. llvm-svn: 168822
* Promote the extension warning for attempts to catch a reference orDouglas Gregor2012-01-241-2/+2
| | | | | | | | | | pointer to incomplete type from an ExtWarn to an error. We put the ExtWarn in place as part of a workaround for Boost (PR6527), but it (1) doesn't actually match a GCC extension and (2) has been fixed for two years in Boost, and (3) causes us to emit code that fails badly at run time, so it's a bad idea to keep it. Fixes PR11803. llvm-svn: 148838
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* 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
* Fix PR8767, improve diagnostic wording when allocating an object of anChandler Carruth2011-02-181-2/+2
| | | | | | | | abstract class type. Patch by Stephen Hines, with a wording tweak from Doug applied by me. llvm-svn: 125996
* Audit uses of Sema::LookupSingleName for those lookups that areDouglas Gregor2010-04-151-0/+13
| | | | | | | | | | | intended for redeclarations, fixing those that need it. Fixes PR6831. This uncovered an issue where the C++ type-specifier-seq parsing logic would try to perform name lookup on an identifier after it already had a type-specifier, which could also lead to spurious ambiguity errors (as in PR6831, but with a different test case). llvm-svn: 101419
* Diagnose attempts to throw an abstract class type.Douglas Gregor2010-04-151-0/+10
| | | | llvm-svn: 101381
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-5/+5
| | | | | | | | | | 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
* Downgrade errors when trying to catch a pointer or reference toDouglas Gregor2010-03-081-2/+2
| | | | | | | | | incomplete type to warnings; GCC (and EDG in GCC compatibility mode) permit such handles. Fixes PR6527. (For real this time) llvm-svn: 97927
* Revert r97925, it only contained the test updates not the actual fix.Chandler Carruth2010-03-081-2/+2
| | | | llvm-svn: 97926
* Downgrade errors when trying to catch a pointer or reference toDouglas Gregor2010-03-071-2/+2
| | | | | | | incomplete type to warnings; GCC (and EDG in GCC compatibility mode) permit such handles. Fixes PR6527. llvm-svn: 97925
* 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
* Track down return statements in the handlers of a function-try-block of ↵Sebastian Redl2009-04-271-0/+29
| | | | | | constructors. Meh ... llvm-svn: 70256
* Don't allow catch declarations to name an abstract classSebastian Redl2009-04-271-0/+3
| | | | llvm-svn: 70248
* Improve validation of C++ exception handling: diagnose throwing incomplete ↵Sebastian Redl2009-04-271-0/+67
types and jumps into protected try-catch scopes. llvm-svn: 70242
OpenPOWER on IntegriCloud