This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c++/26693
- From: Jason Merrill <jason at redhat dot com>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 04 Dec 2008 09:28:00 -0500
- Subject: Re: [PATCH] PR c++/26693
- References: <4908DEAF.5040607@redhat.com> <6c33472e0810291622y13afde4tcbef839ad16fc4df@mail.gmail.com> <4909C2F6.4090901@redhat.com> <490F4917.1010702@redhat.com> <491AE5DE.5010003@redhat.com> <491B4E89.6050200@redhat.com> <491B6171.9000400@redhat.com> <491C7E17.4010902@redhat.com> <49216763.7030404@redhat.com> <4921A948.8020202@redhat.com> <4921EB90.6070302@redhat.com> <4922FC81.2090008@redhat.com> <49328CD9.3000100@redhat.com> <49356AFF.7010105@redhat.com> <4937211B.8040101@redhat.com>
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