aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-07-25 16:35:20 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-07-25 16:35:20 +0000
commit22038b2cf5871bdb8613ef35358bc87e478696cf (patch)
treeb7b00b9ffe9b124134495d45b49383a557b163ad /gcc/cp/semantics.c
parent6c84c6686d1ec71c9eea05ce48366a94ab85e1bf (diff)
downloadgcc-22038b2cf5871bdb8613ef35358bc87e478696cf.zip
gcc-22038b2cf5871bdb8613ef35358bc87e478696cf.tar.gz
gcc-22038b2cf5871bdb8613ef35358bc87e478696cf.tar.bz2
re PR c++/11617 (g++ does not report missing member functions)
cp: PR c++/11617 * cp-tree.h (qualified_name_lookup_error): Declare. * pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for errors. (tsubst_expr) <DECL_STMT case>: Likewise. (tsubst_copy_and_build) <COMPONENT_REF case>: Likewise. * semantics.c (qualified_name_lookup_error): New, broken out of ... (finish_id_expression): ... here. Use it. testsuite: PR c++/11617 * g++.dg/template/lookup2.C: New test. * g++.dg/template/memclass1.C: Remove instantiated from error. From-SVN: r69790
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 102653a..50c7478 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2248,6 +2248,24 @@ check_multiple_declarators (void)
error ("multiple declarators in template declaration");
}
+/* Issue a diagnostic that NAME cannot be found in SCOPE. */
+
+void
+qualified_name_lookup_error (tree scope, tree name)
+{
+ if (TYPE_P (scope))
+ {
+ if (!COMPLETE_TYPE_P (scope))
+ error ("incomplete type `%T' used in nested name specifier", scope);
+ else
+ error ("`%D' is not a member of `%T'", name, scope);
+ }
+ else if (scope != global_namespace)
+ error ("`%D' is not a member of `%D'", name, scope);
+ else
+ error ("`::%D' has not been declared", name);
+}
+
/* ID_EXPRESSION is a representation of parsed, but unprocessed,
id-expression. (See cp_parser_id_expression for details.) SCOPE,
if non-NULL, is the type or namespace used to explicitly qualify
@@ -2307,17 +2325,9 @@ finish_id_expression (tree id_expression,
if (scope && (!TYPE_P (scope) || !dependent_type_p (scope)))
{
/* Qualified name lookup failed, and the qualifying name
- was not a dependent type. That is always an
- error. */
- if (TYPE_P (scope) && !COMPLETE_TYPE_P (scope))
- error ("incomplete type `%T' used in nested name "
- "specifier",
- scope);
- else if (scope != global_namespace)
- error ("`%D' is not a member of `%D'",
- id_expression, scope);
- else
- error ("`::%D' has not been declared", id_expression);
+ was not a dependent type. That is always an
+ error. */
+ qualified_name_lookup_error (scope, id_expression);
return error_mark_node;
}
else if (!scope)