diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-01-31 04:07:41 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2005-01-31 04:07:41 +0000 |
commit | 232126faed15d37e5e4cbb080860f26e208a4a0e (patch) | |
tree | 3efc5b87b185b27850c5bc0e135aea691edb8b36 /gcc/cp/decl.c | |
parent | 2ddc1c47eecdda910e38486695c1cc6b7616cc1e (diff) |
PR c++/19395
* decl.c (grokdeclarator): Refactor code so that qualified names
are never allowed as the declarator in a typedef.
PR c++/19367
* name-lookup.c (do_nonmember_using_decl): Avoid overloading
builtin declarations.
PR c++/19395
* g++.dg/parse/error24.C: New test.
PR c++/19367
* g++.dg/lookup/builtin1.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@94466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f65427a8b1b..e2408e36b82 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7524,18 +7524,14 @@ grokdeclarator (const cp_declarator *declarator, TYPE_FOR_JAVA (type) = 1; if (decl_context == FIELD) - { - if (constructor_name_p (unqualified_id, current_class_type)) - pedwarn ("ISO C++ forbids nested type %qD with same name " - "as enclosing class", - unqualified_id); - decl = build_lang_decl (TYPE_DECL, unqualified_id, type); - } + decl = build_lang_decl (TYPE_DECL, unqualified_id, type); else + decl = build_decl (TYPE_DECL, unqualified_id, type); + if (id_declarator && declarator->u.id.qualifying_scope) + error ("%Jtypedef name may not be a nested-name-specifier", decl); + + if (decl_context != FIELD) { - decl = build_decl (TYPE_DECL, unqualified_id, type); - if (in_namespace || ctype) - error ("%Jtypedef name may not be a nested-name-specifier", decl); if (!current_function_decl) DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); else if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (current_function_decl) @@ -7547,6 +7543,10 @@ grokdeclarator (const cp_declarator *declarator, clones. */ DECL_ABSTRACT (decl) = 1; } + else if (constructor_name_p (unqualified_id, current_class_type)) + pedwarn ("ISO C++ forbids nested type %qD with same name " + "as enclosing class", + unqualified_id); /* If the user declares "typedef struct {...} foo" then the struct will have an anonymous name. Fill that name in now. |