PR c++/17011, c++/17971
PR c++/17011, c++/17971 * pt.c (tsubst_copy) <FIELD_DECL case>: Check and diagnose invalid field. (tsubst_copy_and_build) <COMPONENT_REF case>: Check error_mark_node after member substitution. * semantics.c (finish_id_expression): Call finish_non_static_data_member for non-dependent FIELD_DECL. * g++.dg/template/error15.C: Adjust expected error. * g++.dg/template/instantiate3.C: Likewise. From-SVN: r91720
This commit is contained in:
parent
73f8783add
commit
bad1f4626e
|
@ -1,3 +1,13 @@
|
|||
2004-12-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/17011, c++/17971
|
||||
* pt.c (tsubst_copy) <FIELD_DECL case>: Check and diagnose
|
||||
invalid field.
|
||||
(tsubst_copy_and_build) <COMPONENT_REF case>: Check
|
||||
error_mark_node after member substitution.
|
||||
* semantics.c (finish_id_expression): Call
|
||||
finish_non_static_data_member for non-dependent FIELD_DECL.
|
||||
|
||||
2004-12-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/18782
|
||||
|
|
15
gcc/cp/pt.c
15
gcc/cp/pt.c
|
@ -7702,7 +7702,16 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
|||
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args, complain, in_decl,
|
||||
/*entering_scope=*/1);
|
||||
if (ctx != DECL_CONTEXT (t))
|
||||
return lookup_field (ctx, DECL_NAME (t), 0, false);
|
||||
{
|
||||
tree r = lookup_field (ctx, DECL_NAME (t), 0, false);
|
||||
if (!r)
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error ("using invalid field %qD", t);
|
||||
return error_mark_node;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
|
@ -8693,7 +8702,9 @@ tsubst_copy_and_build (tree t,
|
|||
else
|
||||
member = tsubst_copy (member, args, complain, in_decl);
|
||||
|
||||
if (!CLASS_TYPE_P (TREE_TYPE (object)))
|
||||
if (member == error_mark_node)
|
||||
return error_mark_node;
|
||||
else if (!CLASS_TYPE_P (TREE_TYPE (object)))
|
||||
{
|
||||
if (TREE_CODE (member) == BIT_NOT_EXPR)
|
||||
return finish_pseudo_destructor_expr (object,
|
||||
|
|
|
@ -2571,6 +2571,12 @@ finish_id_expression (tree id_expression,
|
|||
if (TREE_CODE (decl) == VAR_DECL
|
||||
|| TREE_CODE (decl) == PARM_DECL)
|
||||
return decl;
|
||||
/* The same is true for FIELD_DECL, but we also need to
|
||||
make sure that the syntax is correct. */
|
||||
else if (TREE_CODE (decl) == FIELD_DECL)
|
||||
return finish_non_static_data_member
|
||||
(decl, current_class_ref,
|
||||
/*qualifying_scope=*/NULL_TREE);
|
||||
return id_expression;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2004-12-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/17011, c++/17971
|
||||
* g++.dg/template/error15.C: Adjust expected error.
|
||||
* g++.dg/template/instantiate3.C: Likewise.
|
||||
|
||||
2004-12-03 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/altivec-18.c: Fix for darwin
|
||||
|
|
|
@ -11,14 +11,14 @@ protected:
|
|||
|
||||
A<T> a; // { dg-error "" }
|
||||
|
||||
void f(const A<T> * a1 = &a);
|
||||
void f(const A<T> * a1 = &a); // { dg-error "this location" }
|
||||
|
||||
void g(void);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void B<T>::g(void) {
|
||||
f(); // { dg-error "" }
|
||||
f();
|
||||
}
|
||||
|
||||
template class B<long>; // { dg-error "" }
|
||||
template class B<long>;
|
||||
|
|
|
@ -10,7 +10,7 @@ template <class TYPE>
|
|||
struct ACE_Cleanup_Adapter
|
||||
{
|
||||
TYPE &object ()
|
||||
{ return object_; } // { dg-error "not declared|reported" }
|
||||
{ return object_; } // { dg-error "invalid" }
|
||||
TYPE object_; // { dg-error "incomplete type" }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue