+2002-02-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/4872
+ * decl.c (finish_function): Warn about a non-void function with
+ no return statement.
+
+ * error.c (dump_scope): Don't add TFF_DECL_SPECIFIERS.
+ (dump_function_decl): Always dump parms.
+
+ * decl2.c (finish_static_data_member_decl): Complain about a local
+ class with a static data member.
+
+ PR c++/4286
+ * search.c (lookup_field_1): Don't xref a static data member
+ just because we looked it up.
+
2002-01-31 Jason Merrill <jason@redhat.com>
* Make-lang.in (parse.c): Handle .output file.
VARRAY_PUSH_TREE (pending_statics, decl);
}
+ if (LOCAL_CLASS_P (current_class_type))
+ pedwarn ("local class `%#T' shall not have static data member `%#D'",
+ current_class_type, decl);
+
/* Static consts need not be initialized in the class definition. */
if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
from TYPE_FIELDS anyhow; see handle_using_decl. */
;
else if (DECL_NAME (field) == name)
- {
- if (TREE_CODE(field) == VAR_DECL
- && (TREE_STATIC (field) || DECL_EXTERNAL (field)))
- GNU_xref_ref(current_function_decl,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (field)));
- return field;
- }
+ return field;
field = TREE_CHAIN (field);
}
/* Not found. */
--- /dev/null
+// PR c++/4286: We were crashing when trying to set up the class bindings in
+// g(), because xref wanted the mangled name, which breaks inside a template.
+
+// Of course, the offending code is actually ill-formed anyway, so check
+// for the error.
+
+struct A
+{
+ template<class T> void f();
+};
+
+template<class T> void A::f()
+{
+ struct B
+ {
+ void g() {}
+ static int x; // { dg-error "static" "" }
+ };
+}
+
+int main ()
+{
+ A a;
+ a.f<int> ();
+}