diff mbox

C++ PATCH for some tiny cleanups

Message ID 57166F9C.60005@redhat.com
State New
Headers show

Commit Message

Jason Merrill April 19, 2016, 5:49 p.m. UTC
A few tiny bits that I noticed while working on other bugs during the 
GCC 6 process and decided to delay until stage 1.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit f2d4d53e2e76715a0a4e6379e75dd9eebff93c54
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Dec 8 15:18:22 2015 -0500

    	Tiny C++ cleanups.
    
    	* pt.c (tsubst_expr): Remove shadowing declaration.
    	(tsubst_pack_expansion): Add assert.
    	* semantics.c (add_decl_expr): Use DECL_SOURCE_LOCATION.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a6d56d1..f9a9d99 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10961,6 +10961,7 @@  tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
 	  /* We can't substitute for this parameter pack.  We use a flag as
 	     well as the missing_level counter because function parameter
 	     packs don't have a level.  */
+	  gcc_assert (processing_template_decl);
 	  unsubstituted_packs = true;
 	}
     }
@@ -15135,7 +15136,6 @@  tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
 	  {
 	    tree scope = USING_DECL_SCOPE (decl);
 	    tree name = DECL_NAME (decl);
-	    tree decl;
 
 	    scope = tsubst (scope, args, complain, in_decl);
 	    decl = lookup_qualified_name (scope, name,
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 0487adf..56864b4 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -428,7 +428,7 @@  maybe_cleanup_point_expr_void (tree expr)
 void
 add_decl_expr (tree decl)
 {
-  tree r = build_stmt (input_location, DECL_EXPR, decl);
+  tree r = build_stmt (DECL_SOURCE_LOCATION (decl), DECL_EXPR, decl);
   if (DECL_INITIAL (decl)
       || (DECL_SIZE (decl) && TREE_SIDE_EFFECTS (DECL_SIZE (decl))))
     r = maybe_cleanup_point_expr_void (r);