+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'.
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);
make_typename_type (context, name)
tree context, name;
{
- tree t;
tree fullname;
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
}
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);
}
/* 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;
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));
// 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
// 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
template<class VertexType, class EdgeType>
class Graph
-{
+{ // ERROR - candidates
public:
// public type interface
typedef map<int, EdgeType > Successor;
bool directed;
GraphType C; // container
ostream* pOut;
-}; // ERROR - candidates
+};
// all graph-methods delet
template<class VertexType, class EdgeType>