aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-06-24 19:18:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-06-24 19:18:43 +0000
commit5f261ba970a894543b1c8c30f71c7eb2a234ba93 (patch)
treebe46d82b47945fa6f5b787b66f752af4d7711a6b /gcc/cp/semantics.c
parent87912be720118115eded3786b807a34cfb0f0a81 (diff)
downloadgcc-5f261ba970a894543b1c8c30f71c7eb2a234ba93.zip
gcc-5f261ba970a894543b1c8c30f71c7eb2a234ba93.tar.gz
gcc-5f261ba970a894543b1c8c30f71c7eb2a234ba93.tar.bz2
cp-tree.h (SCALAR_TYPE_P): New macro.
* cp-tree.h (SCALAR_TYPE_P): New macro. (check_for_out_of_scope_variable): New function. (at_class_scope_p): Likewise. (finish_fname): Likewise. * class.c (finish_struct): Use at_function_scope_p. * decl.c (check_for_out_of_scope_variable): New function, split out from do_identifier. (finish_enum): Use at_function_scope_p. * lex.c (do_identifier): Use check_for_out_of_scope_variable. * parse.y (VAR_FUNC_NAME): Give it <ttype>. Use finish_fname. (primary): Use at_function_scope_p. * search.c (at_class_scope_p): New function. * semantics.c (finish_fname): Likewise. (check_multiple_declarators): Use at_function_scope_p. From-SVN: r54962
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index c6c3047..0f671ae 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1437,6 +1437,20 @@ finish_id_expr (expr)
return expr;
}
+/* Return the declaration for the function-name variable indicated by
+ ID. */
+
+tree
+finish_fname (tree id)
+{
+ tree decl;
+
+ decl = fname_decl (C_RID_CODE (id), id);
+ if (processing_template_decl)
+ decl = build_min_nt (LOOKUP_EXPR, DECL_NAME (decl));
+ return decl;
+}
+
static tree current_type_lookups;
/* Perform deferred access control for types used in the type of a
@@ -2025,9 +2039,7 @@ check_multiple_declarators ()
We don't just use PROCESSING_TEMPLATE_DECL for the first
condition since that would disallow the perfectly legal code,
like `template <class T> struct S { int i, j; };'. */
- tree scope = current_scope ();
-
- if (scope && TREE_CODE (scope) == FUNCTION_DECL)
+ if (at_function_scope_p ())
/* It's OK to write `template <class T> void f() { int i, j;}'. */
return;