{  e = make_node (PTRMEM_CST); TREE_TYPE (e) = type; PTRMEM_CST_MEMBER (e) = PTRMEM_CST_MEMBER (expr); }
e = make_ptrmem_cst (type, PTRMEM_CST_MEMBER (expr));
convert_nontype_argument (type, expr)     tree type;     tree expr;{  tree expr_type = TREE_TYPE (expr);  /* A template-argument for a non-type, non-template     template-parameter shall be one of:     --an integral constant-expression of integral or enumeration     type; or          --the name of a non-type template-parameter; or          --the name of an object or function with external linkage,     including function templates and function template-ids but     excluding non-static class members, expressed as id-expression;     or          --the address of an object or function with external linkage,     including function templates and function template-ids but     excluding non-static class members, expressed as & id-expression     where the & is optional if the name refers to a function or     array; or          --a pointer to member expressed as described in _expr.unary.op_.  */  /* An integral constant-expression can include const variables     or enumerators.  */  if (INTEGRAL_TYPE_P (expr_type) && TREE_READONLY_DECL_P (expr))    expr = decl_constant_value (expr);  if (is_overloaded_fn (expr))    /* OK for now.  We'll check that it has external linkage later.       Check this first since if expr_type is the unknown_type_node       we would otherwise complain below.  */    ;  else if (TYPE_PTRMEM_P (expr_type)	   || TYPE_PTRMEMFUNC_P (expr_type))    {      if (TREE_CODE (expr) != PTRMEM_CST)	goto bad_argument;    }  else if (TYPE_PTR_P (expr_type)	   || TYPE_PTRMEM_P (expr_type)	   || TREE_CODE (expr_type) == ARRAY_TYPE	   || TREE_CODE (type) == REFERENCE_TYPE	   /* If expr is the address of an overloaded function, we	      will get the unknown_type_node at this point.  */	   || expr_type == unknown_type_node)    {      tree referent;      tree e = expr;      STRIP_NOPS (e);      if (TREE_CODE (type) == REFERENCE_TYPE	  || TREE_CODE (expr_type) == ARRAY_TYPE)	referent = e;      else	{	  if (TREE_CODE (e) != ADDR_EXPR)	    {	    bad_argument:	      cp_error ("`%E' is not a valid template argument", expr);	      if (TYPE_PTR_P (expr_type))		{		  if (TREE_CODE (TREE_TYPE (expr_type)) == FUNCTION_TYPE)		    cp_error ("it must be the address of a function with external linkage");		  else		    cp_error ("it must be the address of an object with external linkage");		}	      else if (TYPE_PTRMEM_P (expr_type)		       || TYPE_PTRMEMFUNC_P (expr_type))		cp_error ("it must be a pointer-to-member of the form `&X::Y'");	      return NULL_TREE;	    }	  referent = TREE_OPERAND (e, 0);	  STRIP_NOPS (referent);	}      if (TREE_CODE (referent) == STRING_CST)	{	  cp_error ("string literal %E is not a valid template argument", 		    referent);	  error ("because it is the address of an object with static linkage");	  return NULL_TREE;	}      if (is_overloaded_fn (referent))	/* We'll check that it has external linkage later.  */	;      else if (TREE_CODE (referent) != VAR_DECL)	goto bad_argument;      else if (!TREE_PUBLIC (referent))	{	  cp_error ("address of non-extern `%E' cannot be used as template argument", referent); 	  return error_mark_node;	}    }  else if (INTEGRAL_TYPE_P (expr_type) 	   || TYPE_PTRMEM_P (expr_type) 	   || TYPE_PTRMEMFUNC_P (expr_type)	   /* The next two are g++ extensions.  */	   || TREE_CODE (expr_type) == REAL_TYPE	   || TREE_CODE (expr_type) == COMPLEX_TYPE)    {      if (! TREE_CONSTANT (expr))	{	non_constant:	  cp_error ("non-constant `%E' cannot be used as template argument",		    expr);	  return NULL_TREE;	}    }  else     {      cp_error ("object `%E' cannot be used as template argument", expr);      return NULL_TREE;    }  switch (TREE_CODE (type))    {    case INTEGER_TYPE:    case BOOLEAN_TYPE:    case ENUMERAL_TYPE:      /* For a non-type template-parameter of integral or enumeration         type, integral promotions (_conv.prom_) and integral         conversions (_conv.integral_) are applied. */      if (!INTEGRAL_TYPE_P (expr_type))	return error_mark_node;            /* It's safe to call digest_init in this case; we know we're	 just converting one integral constant expression to another.  */      expr = digest_init (type, expr, (tree*) 0);      if (TREE_CODE (expr) != INTEGER_CST)	/* Curiously, some TREE_CONSTANT integral expressions do not	   simplify to integer constants.  For example, `3 % 0',	   remains a TRUNC_MOD_EXPR.  */	goto non_constant;            return expr;	    case REAL_TYPE:    case COMPLEX_TYPE:      /* These are g++ extensions.  */      if (TREE_CODE (expr_type) != TREE_CODE (type))	return error_mark_node;      expr = digest_init (type, expr, (tree*) 0);            if (TREE_CODE (expr) != REAL_CST)	goto non_constant;      return expr;    case POINTER_TYPE:      {	tree type_pointed_to = TREE_TYPE (type); 	if (TYPE_PTRMEM_P (type))	  {	    tree e;	    /* For a non-type template-parameter of type pointer to data	       member, qualification conversions (_conv.qual_) are	       applied.  */	    e = perform_qualification_conversions (type, expr);	    if (TREE_CODE (e) == NOP_EXPR)	      {		/* The call to perform_qualification_conversions will		   insert a NOP_EXPR over EXPR to do express		   conversion, if necessary.  But, that will confuse		   us if we use this (converted) template parameter to		   instantiate another template; then the thing will		   not look like a valid template argument.  So, just		   make a new constant, of the appropriate type.  */		e = make_node (PTRMEM_CST);		TREE_TYPE (e) = type;		PTRMEM_CST_MEMBER (e) = PTRMEM_CST_MEMBER (expr);	      }	    return e;	  }	else if (TREE_CODE (type_pointed_to) == FUNCTION_TYPE)	  { 	    /* For a non-type template-parameter of type pointer to	       function, only the function-to-pointer conversion	       (_conv.func_) is applied.  If the template-argument	       represents a set of overloaded functions (or a pointer to	       such), the matching function is selected from the set	       (_over.over_).  */	    tree fns;	    tree fn;	    if (TREE_CODE (expr) == ADDR_EXPR)	      fns = TREE_OPERAND (expr, 0);	    else	      fns = expr;	    fn = instantiate_type (type_pointed_to, fns, 0);	    if (fn == error_mark_node)	      return error_mark_node;	    if (!TREE_PUBLIC (fn))	      {		if (really_overloaded_fn (fns))		  return error_mark_node;		else		  goto bad_argument;	      }	    expr = build_unary_op (ADDR_EXPR, fn, 0);	    my_friendly_assert (same_type_p (type, TREE_TYPE (expr)), 				0);	    return expr;	  }	else 	  {	    /* For a non-type template-parameter of type pointer to	       object, qualification conversions (_conv.qual_) and the	       array-to-pointer conversion (_conv.array_) are applied.	       [Note: In particular, neither the null pointer conversion	       (_conv.ptr_) nor the derived-to-base conversion	       (_conv.ptr_) are applied.  Although 0 is a valid	       template-argument for a non-type template-parameter of	       integral type, it is not a valid template-argument for a	       non-type template-parameter of pointer type.]  	    	       The call to decay_conversion performs the	       array-to-pointer conversion, if appropriate.  */	    expr = decay_conversion (expr);	    if (expr == error_mark_node)	      return error_mark_node;	    else	      return perform_qualification_conversions (type, expr);	  }      }      break;    case REFERENCE_TYPE:      {	tree type_referred_to = TREE_TYPE (type);	if (TREE_CODE (type_referred_to) == FUNCTION_TYPE)	  {	    /* For a non-type template-parameter of type reference to	       function, no conversions apply.  If the	       template-argument represents a set of overloaded	       functions, the matching function is selected from the	       set (_over.over_).  */	    tree fns = expr;	    tree fn;	    fn = instantiate_type (type_referred_to, fns, 0);	    if (fn == error_mark_node)	      return error_mark_node;	    if (!TREE_PUBLIC (fn))	      {		if (really_overloaded_fn (fns))		  /* Don't issue an error here; we might get a different		     function if the overloading had worked out		     differently.  */		  return error_mark_node;		else		  goto bad_argument;	      }	    my_friendly_assert (same_type_p (type_referred_to, 					     TREE_TYPE (fn)),				0);	    return fn;	  }	else	  {	    /* For a non-type template-parameter of type reference to	       object, no conversions apply.  The type referred to by the	       reference may be more cv-qualified than the (otherwise	       identical) type of the template-argument.  The	       template-parameter is bound directly to the	       template-argument, which must be an lvalue.  */	    if ((TYPE_MAIN_VARIANT (expr_type)		 != TYPE_MAIN_VARIANT (type_referred_to))		|| !at_least_as_qualified_p (type_referred_to,					     expr_type)		|| !real_lvalue_p (expr))	      return error_mark_node;	    else	      return expr;	  }      }      break;    case RECORD_TYPE:      {	if (!TYPE_PTRMEMFUNC_P (type))	  /* This handles templates like	       template<class T, T t> void f();	     when T is substituted with any class.  The second template	     parameter becomes invalid and the template candidate is	     rejected.  */	  return error_mark_node;	/* For a non-type template-parameter of type pointer to member	   function, no conversions apply.  If the template-argument	   represents a set of overloaded member functions, the	   matching member function is selected from the set	   (_over.over_).  */	if (!TYPE_PTRMEMFUNC_P (expr_type) && 	    expr_type != unknown_type_node)	  return error_mark_node;	if (TREE_CODE (expr) == PTRMEM_CST)	  {	    /* A ptr-to-member constant.  */	    if (!same_type_p (type, expr_type))	      return error_mark_node;	    else 	      return expr;	  }	if (TREE_CODE (expr) != ADDR_EXPR)	  return error_mark_node;	expr = instantiate_type (type, expr, 0);		if (expr == error_mark_node)	  return error_mark_node;	my_friendly_assert (same_type_p (type, TREE_TYPE (expr)),			    0);	return expr;      }      break;    default:      /* All non-type parameters must have one of these types.  */      my_friendly_abort (0);      break;    }  return error_mark_node;}