View | Details | Return to bug 40315
Collapse All | Expand All

(-)a/gcc/cp/cp-tree.h (+1 lines)
Lines 4858-4863 extern tree get_template_innermost_arguments (const_tree); Link Here
4858
extern tree get_template_argument_pack_elems	(const_tree);
4858
extern tree get_template_argument_pack_elems	(const_tree);
4859
extern tree get_function_template_decl		(const_tree);
4859
extern tree get_function_template_decl		(const_tree);
4860
extern tree resolve_nondeduced_context		(tree);
4860
extern tree resolve_nondeduced_context		(tree);
4861
extern bool placeholder_type_p			(tree);
4861
4862
4862
/* in repo.c */
4863
/* in repo.c */
4863
extern void init_repo				(void);
4864
extern void init_repo				(void);
(-)a/gcc/cp/decl.c (-1 / +2 lines)
Lines 9847-9853 grokparms (tree parmlist, tree *parms) Link Here
9847
9847
9848
	  /* Top-level qualifiers on the parameters are
9848
	  /* Top-level qualifiers on the parameters are
9849
	     ignored for function types.  */
9849
	     ignored for function types.  */
9850
	  type = cp_build_qualified_type (type, 0);
9850
	  if (!placeholder_type_p (type))
9851
	    type = cp_build_qualified_type (type, 0);
9851
	  if (TREE_CODE (type) == METHOD_TYPE)
9852
	  if (TREE_CODE (type) == METHOD_TYPE)
9852
	    {
9853
	    {
9853
	      error ("parameter %qD invalidly declared method type", decl);
9854
	      error ("parameter %qD invalidly declared method type", decl);
(-)a/gcc/cp/pt.c (-2 / +35 lines)
Lines 9341-9351 tsubst_arg_types (tree arg_types, Link Here
9341
              error ("in declaration %q+D", in_decl);
9341
              error ("in declaration %q+D", in_decl);
9342
          }
9342
          }
9343
        return error_mark_node;
9343
        return error_mark_node;
9344
    }
9344
      }
9345
    
9345
    
9346
    /* Do array-to-pointer, function-to-pointer conversion, and ignore
9346
    /* Do array-to-pointer, function-to-pointer conversion, and ignore
9347
       top-level qualifiers as required.  */
9347
       top-level qualifiers as required.  */
9348
    type = TYPE_MAIN_VARIANT (type_decays_to (type));
9348
    type = type_decays_to (type);
9349
    if (!placeholder_type_p (type))
9350
      type = cp_build_qualified_type (type, 0);
9349
9351
9350
    /* We do not substitute into default arguments here.  The standard
9352
    /* We do not substitute into default arguments here.  The standard
9351
       mandates that they be instantiated only when needed, which is
9353
       mandates that they be instantiated only when needed, which is
Lines 18146-18149 init_template_processing (void) Link Here
18146
					  ggc_free);
18148
					  ggc_free);
18147
}
18149
}
18148
18150
18151
/* Returns true iff TYPE is a type which will be entirely replaced by
18152
   template substitution, e.g. a template type parm or 'typename'.  */
18153
18154
bool
18155
placeholder_type_p (tree type)
18156
{
18157
  switch (TREE_CODE (type))
18158
    {
18159
      /* These aren't really types.  */
18160
    case TEMPLATE_TEMPLATE_PARM:
18161
    case UNBOUND_CLASS_TEMPLATE:
18162
      gcc_unreachable ();
18163
18164
      /* FIXME we ought to handle these better in grokparms and
18165
	 tsubst_arg_types.  */
18166
    case TYPE_PACK_EXPANSION:
18167
      return true;
18168
18169
    case TEMPLATE_TYPE_PARM:
18170
    case TYPENAME_TYPE:
18171
    case TYPEOF_TYPE:
18172
    case DECLTYPE_TYPE:
18173
    case BOUND_TEMPLATE_TEMPLATE_PARM:
18174
    case TYPE_ARGUMENT_PACK:
18175
      return true;
18176
18177
    default:
18178
      return false;
18179
    }
18180
}
18181
18149
#include "gt-cp-pt.h"
18182
#include "gt-cp-pt.h"
(-)a/gcc/testsuite/g++.dg/template/param2.C (+13 lines)
Line 0 Link Here
1
// PR c++/40315
2
3
template<int D>
4
struct Foo
5
{
6
  typedef double double3[3];
7
};
8
9
template<int D>
10
void doSomething(const typename Foo<D>::double3) { }
11
12
template void doSomething<2>(const Foo<2>::double3);
13
template void doSomething<3>(const Foo<3>::double3);
(-)a/libstdc++-v3/include/ext/sso_string_base.h (-1 / +1 lines)
Lines 529-535 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) Link Here
529
    void
529
    void
530
    __sso_string_base<_CharT, _Traits, _Alloc>::
530
    __sso_string_base<_CharT, _Traits, _Alloc>::
531
    _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
531
    _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
532
	      const size_type __len2)
532
	      size_type __len2)
533
    {
533
    {
534
      const size_type __how_much = _M_length() - __pos - __len1;
534
      const size_type __how_much = _M_length() - __pos - __len1;
535
      
535
      

Return to bug 40315