This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR c++/26693


Dodji Seketeli wrote:
The test case in the attached patch, in file gcc/testsuite/g++.dg/template/typedef14.C. The assert is hit when calling fold_non_dependent_expr on "~static_cast<mytype> (0)", which eventually calls tsubst on the mytype typedef.

When we tsubst the mytype typedef, we hit the line:
tree gen_args = tsubst (DECL_TI_ARGS (decl), args, complain, in_decl);

Ah, OK. So in this case we're still in the template, so what we want is the template version of the typedef, so just adding


if (args == NULL_TREE)
  return t;

to the top of tsubst, or the top of the typedef reuse bit, would give the right answer.

I changed this to actually put the code to append the type the list of access checks for the template into check_accessibility_of_qualified_id,

I thought about that possibility, but then you don't diagnose


class A
{
 typedef int foo;
};

template <class T>
class B: public A
{
  foo f;
};

+append_type_to_template_for_access_check (tree type,

Don't we need to do the same thing in function templates?

I am not sure to understand why this wouldn't work for typedef types referenced in function templates. Could you please tell me what I am missing ?

I guess I was just confused by the parameter named "type". Please rename it to "tmpl" or some such. :)


Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]