This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR c++/26693
- From: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- To: "Dodji Seketeli" <dodji at redhat dot com>
- Cc: "Gcc Patch List" <gcc-patches at gcc dot gnu dot org>, "Jason Merrill" <jason at redhat dot com>
- Date: Thu, 30 Oct 2008 00:22:49 +0100
- Subject: Re: [PATCH] PR c++/26693
- References: <4908DEAF.5040607@redhat.com>
2008/10/29 Dodji Seketeli <dodji@redhat.com>:
> +
> + /* When a typedef statement appears in a class/struct, make sure a
> + 'typedef variant type' node is associated to that typedef
> statement.
> + This will help to later be able to check the access of the typedef
> name.
> + Please read the comment of the function clone_underlying_type in
> + c-decl.c to learn more about how to represent the type of
> + a typedef statement. */
> + if (decl_context == FIELD
> + && !uses_template_parms (type))
> + {
> + if (DECL_IS_BUILTIN (decl))
> + {
> + if (TYPE_NAME (type) == 0)
> + TYPE_NAME (type) = decl;
> + }
> + else
> + {
> + DECL_ORIGINAL_TYPE (decl) = type;
> + type = build_variant_type_copy (type);
> + TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE
> (decl));
> + TYPE_NAME (type) = decl;
> + TREE_TYPE (decl) = type;
> + }
> + }
> +
> +
Couldn't you abstract out this code and clone_underlying_type into a
function shared by C/C++? They look almost the same to me. Actually, I
don't understand why c-decl.c does not use TYPE_STUB_DECL.
Moreover, this actually means that we track typedefs, don't we? That
could improve so much our diagnostics in C++!
> @@ -8921,22 +8921,41 @@ tsubst (tree t, tree args, tsubst_flags_t complain,
> tree in_decl)
> && TYPE_NAME (t) != TYPE_MAIN_DECL (t))
> {
> tree decl = TYPE_NAME (t);
> -
> +
Whitespace
> diff --git a/gcc/testsuite/g++.dg/template/typedef11.C
> b/gcc/testsuite/g++.dg/template/typedef11.C
> index db7a1d3..6e71729 100644
> --- a/gcc/testsuite/g++.dg/template/typedef11.C
> +++ b/gcc/testsuite/g++.dg/template/typedef11.C
Is this patch against trunk? I don't see this testcase in FSF's trunk.
Cheers,
Manuel.