decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup...
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Oct 2019 22:19:13 +0000 (00:19 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Oct 2019 22:19:13 +0000 (00:19 +0200)
* decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
if cleanup is a nop, clear location of its operand too.

From-SVN: r277084

gcc/cp/ChangeLog
gcc/cp/decl.c

index ecaf312639bf0ce0a3d2e140a5a5bd2c36c3e60e..6c1e6b46377b1be3bf684becde8279540a4f101b 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
+       if cleanup is a nop, clear location of its operand too.
+
 2019-10-15  Nathan Sidwell  <nathan@acm.org>
 
        * class.c (build_clones): Break out of clone_function_decl.  Just
index a9ff4275a6707ae1c0f04a47b67025473ebda863..5e510c91aa30c0c35afe49669a60895203f0719c 100644 (file)
@@ -16864,6 +16864,8 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
      the end of the block.  So let's unset the location of the
      destructor call instead.  */
   protected_set_expr_location (cleanup, UNKNOWN_LOCATION);
+  if (cleanup && CONVERT_EXPR_P (cleanup))
+    protected_set_expr_location (TREE_OPERAND (cleanup, 0), UNKNOWN_LOCATION);
 
   if (cleanup
       && DECL_P (decl)