From f0074abfd18d7ef253af3988e3961ee7f5bbaa0f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 26 May 2017 09:37:58 -0600 Subject: [PATCH] Better document why we take a large argument by value. This addresses an issue found by Coverity. We copy the argument intentionally. --- include/deal.II/base/exceptions.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 5b80e219dd..4ed28c650b 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -265,16 +265,22 @@ namespace deal_II_exceptions * This routine does the main work for the exception generation mechanism * used in the Assert macro. * + * The actual exception object (the last argument) is typically an unnamed + * object created in place; because we modify it, we can't take it by + * const reference, and temporaries don't bind to non-const references. + * So take it by value (=copy it) -- the performance implications are + * pretty minimal anyway. + * * @ref ExceptionBase */ - template - void issue_error (ExceptionHandling handling, - const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) + template + void issue_error (ExceptionHandling handling, + const char *file, + int line, + const char *function, + const char *cond, + const char *exc_name, + ExceptionType e) { // Fill the fields of the exception object e.set_fields (file, line, function, cond, exc_name); -- 2.39.5