summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/exception-spec.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR38627: Fix handling of exception specification adjustment forRichard Smith2018-09-051-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | destructors. We previously tried to patch up the exception specification after completing the class, which went wrong when the exception specification was needed within the class body (in particular, by a friend redeclaration of the destructor in a nested class). We now mark the destructor as having a not-yet-computed exception specification immediately after creating it. This requires delaying various checks against the exception specification (where we'd previously have just got the wrong exception specification, and now find we have an exception specification that we can't compute yet) when those checks fire while the class is being defined. This also exposed an issue that we were missing a CodeSynthesisContext for computation of exception specifications (otherwise we'd fail to make the module containing the definition of the class visible when computing its members' exception specs). Adding that incidentally also gives us a diagnostic quality improvement. This has also exposed an pre-existing problem: making the exception specification evaluation context a non-SFINAE context (as it should be) results in a bootstrap failure; PR38850 filed for this. llvm-svn: 341499
* Promote a warning on ill-formed code (redeclaration missing an exceptionRichard Smith2015-09-301-0/+7
| | | | | | | | | | | | | | | | | specification) to an error. No compiler other than Clang seems to allow this, and it doesn't seem like a useful thing to accept as an extension in general. The current behavior was added for PR5957, where the problem was specifically related to mismatches of the exception specification on the implicitly-declared global operator new and delete. To retain that workaround, we downgrade the error to an ExtWarn when the declaration is of a replaceable global allocation function. Now that this is an error, stop trying (and failing) to recover from a missing computed noexcept specification. That recovery didn't work, and led to crashes in code like the added testcase. llvm-svn: 248867
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-193/+0
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Semantic checking for exception specifications should be triggered byJohn McCall2011-03-021-1/+1
| | | | | | whether C++ exceptions are enabled, not exceptions in general. PR9358. llvm-svn: 126820
* Emulate (some of) Microsoft's looser semantic checking of exceptionDouglas Gregor2010-08-301-11/+1
| | | | | | specifications, from Martin Vejnar! llvm-svn: 112482
* When a declaration of a function is missing an exception specificationDouglas Gregor2010-03-241-3/+3
| | | | | | | | | | | | | | | | | | | | | that was present in a prior declaration, emit a warning rather than a hard error (which we did before, and still do with mismatched exception specifications). Moreover, provide a fix-it hint with the throw() clause that should be added, e.g., t.C:10:7: warning: 'operator new' is missing exception specification 'throw(std::bad_alloc)' void *operator new(unsigned long sz) ^ throw(std::bad_alloc) As part of this, disable the warning when we're missing an exception specification on operator new, operator new[], operator delete, or operator delete[] when exceptions are turned off (-fno-exceptions). Fixes PR5957. llvm-svn: 99388
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-3/+3
| | | | | | | | | | 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
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-191-5/+5
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* 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
* Implement C++ DR437, which involves exception-specifications that nameDouglas Gregor2009-12-101-2/+15
| | | | | | a type currently being defined, from Nicola Gigante! llvm-svn: 91052
* Add a DR437 testcase, but disable it for now, since it fails.Sebastian Redl2009-10-171-0/+3
| | | | llvm-svn: 84345
* Use partial diagnostics properly in call to RequireCompleteType. Among other ↵Sebastian Redl2009-10-141-1/+6
| | | | | | things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification. llvm-svn: 84099
* Do exception spec compatibility tests for member pointers, too.Sebastian Redl2009-10-141-0/+14
| | | | llvm-svn: 84098
* Types appearing more than once in a spec shouldn't matter.Sebastian Redl2009-10-111-0/+4
| | | | llvm-svn: 83766
* Test exception spec compatibility on return type and parameters.Sebastian Redl2009-10-111-4/+4
| | | | | | | Along the way, use RequireCompleteType when testing exception spec types. Separate all the ugly spec stuff into its own file. llvm-svn: 83764
* Implement the core checking for compatible exception specifications in ↵Sebastian Redl2009-10-101-7/+7
| | | | | | | | | assignment and initialization. The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet. This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment. llvm-svn: 83710
* Extend the exception spec test even further. Now I need to implement this.Sebastian Redl2009-08-271-0/+44
| | | | llvm-svn: 80276
* Enhance testing of overriding exception specs for inaccessible base exceptions.Sebastian Redl2009-07-181-0/+6
| | | | llvm-svn: 76317
* Implement checking of exception spec compatibility for overriding virtual ↵Sebastian Redl2009-07-071-0/+51
| | | | | | functions. llvm-svn: 74943
* Catch function redeclarations with incompatible exception specifications.Sebastian Redl2009-07-041-1/+29
| | | | llvm-svn: 74787
* Disallow exception specs on typedefs.Sebastian Redl2009-05-311-1/+1
| | | | llvm-svn: 72664
* Reject incomplete types in exception specs.Sebastian Redl2009-05-291-0/+10
| | | | llvm-svn: 72580
* Disallow exception specifications on multi-level indirections.Sebastian Redl2009-05-291-0/+25
llvm-svn: 72571
OpenPOWER on IntegriCloud