2019-04-29  Nathan Sidwell  <nathan@acm.org>

	* decl.c (duplicate_decls): Add whitespace, move comments into
	conditional blocks.
	* method.c (explain_implicit_non_constexpr): Refactor.
	* pt.c (check_explicit_specialization): Fix indentation.
	* semantics.c (process_outer_var_ref): Reformat.
	(finish_id_expression_1): Use STRIP_TEMPLATE.

Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 270651)
+++ gcc/cp/decl.c	(working copy)
@@ -1,4 +1,4 @@
-/* Process declarations and variables for C++ compiler.
+/* Process declarations and variables for -*- C++ -*- compiler.
    Copyright (C) 1988-2019 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
@@ -1476,7 +1476,7 @@ duplicate_decls (tree newdecl, tree oldd
 
 		  if (! same_type_p (TREE_VALUE (t1), TREE_VALUE (t2)))
 		    break;
-next_arg:;
+		next_arg:;
 		}
 
 	      warning_at (newdecl_loc,
@@ -2386,9 +2386,10 @@ next_arg:;
 	    }
 	  DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
 	}
-      /* Only functions have these fields.  */
+
       if (DECL_DECLARES_FUNCTION_P (newdecl))
 	{
+	  /* Only functions have these fields.  */
 	  DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
 	  DECL_BEFRIENDING_CLASSES (newdecl)
 	    = chainon (DECL_BEFRIENDING_CLASSES (newdecl),
@@ -2398,10 +2399,12 @@ next_arg:;
 	  if (DECL_VIRTUAL_P (newdecl))
 	    SET_DECL_THUNKS (newdecl, DECL_THUNKS (olddecl));
 	}
-      /* Only variables have this field.  */
-      else if (VAR_P (newdecl)
-	       && VAR_HAD_UNKNOWN_BOUND (olddecl))
-	SET_VAR_HAD_UNKNOWN_BOUND (newdecl);
+      else if (VAR_P (newdecl))
+	{
+	  /* Only variables have this field.  */
+	  if (VAR_HAD_UNKNOWN_BOUND (olddecl))
+	    SET_VAR_HAD_UNKNOWN_BOUND (newdecl);
+	}
     }
 
   if (TREE_CODE (newdecl) == FUNCTION_DECL)
Index: gcc/cp/method.c
===================================================================
--- gcc/cp/method.c	(revision 270651)
+++ gcc/cp/method.c	(working copy)
@@ -1884,15 +1884,14 @@ maybe_explain_implicit_delete (tree decl
 void
 explain_implicit_non_constexpr (tree decl)
 {
-  tree parm_type = TREE_VALUE (FUNCTION_FIRST_USER_PARMTYPE (decl));
-  bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
+  tree parms = FUNCTION_FIRST_USER_PARMTYPE (decl);
+  bool const_p = CP_TYPE_CONST_P (non_reference (TREE_VALUE (parms)));
   tree inh = DECL_INHERITED_CTOR (decl);
   bool dummy;
   synthesized_method_walk (DECL_CLASS_CONTEXT (decl),
 			   special_function_p (decl), const_p,
 			   NULL, NULL, NULL, &dummy, true,
-			   &inh,
-			   FUNCTION_FIRST_USER_PARMTYPE (decl));
+			   &inh, parms);
 }
 
 /* DECL is an instantiation of an inheriting constructor template.  Deduce
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 270651)
+++ gcc/cp/pt.c	(working copy)
@@ -3026,7 +3026,7 @@ check_explicit_specialization (tree decl
 	     `operator T'.  Grab all the conversion operators, and
 	     then select from them.  */
 	  tree fns = get_class_binding (ctype, IDENTIFIER_CONV_OP_P (name)
-				      ? conv_op_identifier : name);
+					? conv_op_identifier : name);
 
 	  if (fns == NULL_TREE)
 	    {
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c	(revision 270651)
+++ gcc/cp/semantics.c	(working copy)
@@ -3482,16 +3482,12 @@ process_outer_var_ref (tree decl, tsubst
 	/* A lambda in an NSDMI (c++/64496).  */
 	break;
 
-      if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr)
-	  == CPLD_NONE)
+      if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) == CPLD_NONE)
 	break;
 
-      lambda_stack = tree_cons (NULL_TREE,
-				lambda_expr,
-				lambda_stack);
+      lambda_stack = tree_cons (NULL_TREE, lambda_expr, lambda_stack);
 
-      containing_function
-	= decl_function_context (containing_function);
+      containing_function = decl_function_context (containing_function);
     }
 
   /* In a lambda within a template, wait until instantiation time to implicitly
@@ -3502,8 +3498,7 @@ process_outer_var_ref (tree decl, tsubst
       && DECL_PACK_P (decl))
     return decl;
 
-  if (lambda_expr && VAR_P (decl)
-      && DECL_ANON_UNION_VAR_P (decl))
+  if (lambda_expr && VAR_P (decl) && DECL_ANON_UNION_VAR_P (decl))
     {
       if (complain & tf_error)
 	error ("cannot capture member %qD of anonymous union", decl);
@@ -3512,11 +3507,8 @@ process_outer_var_ref (tree decl, tsubst
   /* Do lambda capture when processing the id-expression, not when
      odr-using a variable.  */
   if (!odr_use && context == containing_function)
-    {
-      decl = add_default_capture (lambda_stack,
-				  /*id=*/DECL_NAME (decl),
-				  initializer);
-    }
+    decl = add_default_capture (lambda_stack,
+				/*id=*/DECL_NAME (decl), initializer);
   /* Only an odr-use of an outer automatic variable causes an
      error, and a constant variable can decay to a prvalue
      constant without odr-use.  So don't complain yet.  */
@@ -3528,8 +3520,7 @@ process_outer_var_ref (tree decl, tsubst
 	{
 	  error ("%qD is not captured", decl);
 	  tree closure = LAMBDA_EXPR_CLOSURE (lambda_expr);
-	  if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr)
-	      == CPLD_NONE)
+	  if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) == CPLD_NONE)
 	    inform (location_of (closure),
 		    "the lambda has no capture-default");
 	  else if (TYPE_CLASS_SCOPE_P (closure))
@@ -3844,10 +3835,11 @@ finish_id_expression_1 (tree id_expressi
 	}
       else if (is_overloaded_fn (decl))
 	{
+	  /* We only need to look at the first function,
+	     because all the fns share the attribute we're
+	     concerned with (all member fns or all non-members).  */
 	  tree first_fn = get_first_fn (decl);
-
-	  if (TREE_CODE (first_fn) == TEMPLATE_DECL)
-	    first_fn = DECL_TEMPLATE_RESULT (first_fn);
+	  first_fn = STRIP_TEMPLATE (first_fn);
 
 	  /* [basic.def.odr]: "A function whose name appears as a
 	     potentially-evaluated expression is odr-used if it is the unique
