Commit 58e1d54c by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

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
parent f883c8dc
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
......
......@@ -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'
......
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.
......
// { 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" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment