re PR c++/10371 (misleading error message for illegal member access)

PR c++/10371
	* semantics.c (finish_non_static_data_member): Handle when
	both processing_template_decl and qualifying_scope are true.

	* g++.dg/lookup/scoped8.C: New test.

From-SVN: r72950
This commit is contained in:
Kriang Lerdsuwanakij 2003-10-26 11:04:36 +00:00 committed by Kriang Lerdsuwanakij
parent f883c8dce3
commit 58e1d54ce9
4 changed files with 35 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-10-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10371
* semantics.c (finish_non_static_data_member): Handle when
both processing_template_decl and qualifying_scope are true.
2003-10-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11076

View File

@ -1224,7 +1224,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
return error_mark_node;
}
TREE_USED (current_class_ptr) = 1;
if (processing_template_decl)
if (processing_template_decl && !qualifying_scope)
{
tree type = TREE_TYPE (decl);
@ -1263,6 +1263,13 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
}
}
/* If PROCESSING_TEMPLATE_DECL is non-zero here, then
QUALIFYING_SCOPE is also non-null. Wrap this in a SCOPE_REF
for now. */
if (processing_template_decl)
return build_min (SCOPE_REF, TREE_TYPE (decl),
qualifying_scope, DECL_NAME (decl));
perform_or_defer_access_check (TYPE_BINFO (access_type), decl);
/* If the data member was named `C::M', convert `*this' to `C'

View File

@ -1,3 +1,8 @@
2003-10-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10371
* g++.dg/lookup/scoped8.C: New test.
2003-10-25 Eric Botcazou <ebotcazou@libertysurf.fr>
* g++.dg/opt/reg-stack3.C: New test.

View File

@ -0,0 +1,16 @@
// { dg-do compile }
// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
// PR c++/10371: Incorrect tree node built in
// finish_non_static_data_member.
struct A
{
int i; // { dg-error "object missing" }
};
template <int> struct B
{
int foo() { return A::i; } // { dg-error "this location" }
};