semantics.c (begin_class_definition): Update the struct's location here ...

* semantics.c (begin_class_definition): Update the struct's
	location here ...
	* class.c (finish_struct): ... rather than here.
	* decl.c (make_typename_type): Don't rely on uninitialized
	variable.

From-SVN: r27326
This commit is contained in:
Nathan Sidwell 1999-06-03 07:16:15 +00:00 committed by Nathan Sidwell
parent 8a8c36562f
commit b4f70b3d42
7 changed files with 24 additions and 28 deletions

View File

@ -1,3 +1,12 @@
1999-06-03 Nathan Sidwell <nathan@acm.org>
* semantics.c (begin_class_definition): Update the struct's
location here ...
* class.c (finish_struct): ... rather than here.
* decl.c (make_typename_type): Don't rely on uninitialized
variable.
1999-05-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (ALL_CFLAGS): Add '-W -Wall'.

View File

@ -4173,23 +4173,6 @@ finish_struct (t, attributes, warn_anon)
tree t, attributes;
int warn_anon;
{
tree name = TYPE_NAME (t);
if (TREE_CODE (name) == TYPE_DECL)
{
extern int lineno;
DECL_SOURCE_FILE (name) = input_filename;
/* For TYPE_DECL that are not typedefs (those marked with a line
number of zero, we don't want to mark them as real typedefs.
If this fails one needs to make sure real typedefs have a
previous line number, even if it is wrong, that way the below
will fill in the right line number. (mrs) */
if (DECL_SOURCE_LINE (name))
DECL_SOURCE_LINE (name) = lineno;
name = DECL_NAME (name);
}
/* Append the fields we need for constructing signature tables. */
if (IS_SIGNATURE (t))
append_signature_fields (t);

View File

@ -5516,7 +5516,6 @@ tree
make_typename_type (context, name)
tree context, name;
{
tree t;
tree fullname;
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
@ -5576,14 +5575,15 @@ make_typename_type (context, name)
}
else
{
if (IS_AGGR_TYPE (context))
t = lookup_field (context, name, 0, 1);
else
tree t;
if (!IS_AGGR_TYPE (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
t = lookup_field (context, name, 0, 1);
if (t)
return TREE_TYPE (t);
}
@ -5591,7 +5591,7 @@ make_typename_type (context, name)
/* If the CONTEXT is not a template type, then either the field is
there now or its never going to be. */
if (!uses_template_parms (context) && !t)
if (!uses_template_parms (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;

View File

@ -1297,6 +1297,10 @@ begin_class_definition (t)
else if (TYPE_SIZE (t))
duplicate_tag_error (t);
/* Update the location of the decl. */
DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
if (TYPE_BEING_DEFINED (t))
{
t = make_lang_type (TREE_CODE (t));

View File

@ -1,9 +1,9 @@
// Build don't link:
template <class T, int i>
struct K {
struct K { // ERROR - forward declaration
void f();
}; // ERROR - forward declaration
};
template <class T>
void

View File

@ -1,9 +1,9 @@
// Build don't link:
template <class A> class B {
template <class A> class B { // ERROR - candidates
A a;
public:
B(A&aa); // ERROR - near match
~B();
}; // ERROR - candidates
};
static B<int> b_int (3); // ERROR - no matching function

View File

@ -17,7 +17,7 @@ inline istream& operator>>(istream& is, Empty& ) { return is;}
template<class VertexType, class EdgeType>
class Graph
{
{ // ERROR - candidates
public:
// public type interface
typedef map<int, EdgeType > Successor;
@ -32,7 +32,7 @@ class Graph
bool directed;
GraphType C; // container
ostream* pOut;
}; // ERROR - candidates
};
// all graph-methods delet
template<class VertexType, class EdgeType>