* decl2.c (build_artificial_parm): Set TREE_READONLY.
* decl.c (bad_specifiers): Allow throw specs on things with
pointer-to-function or -member-function type.
* init.c (build_default_init): Don't use a CONSTRUCTOR to initialize
a pmf.
From-SVN: r39810
+2001-02-17 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (build_artificial_parm): Set TREE_READONLY.
+
+ * decl.c (bad_specifiers): Allow throw specs on things with
+ pointer-to-function or -member-function type.
+ * init.c (build_default_init): Don't use a CONSTRUCTOR to initialize
+ a pmf.
+
2001-02-17 Mark Mitchell <mark@codesourcery.com>
* call.c (check_dtor_name): Handle template names correctly.
object, type);
if (friendp)
cp_error_at ("`%D' declared as a friend", object);
- if (raises)
+ if (raises && !TYPE_PTRFN_P (TREE_TYPE (object))
+ && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object)))
cp_error_at ("`%D' declared with an exception specification", object);
}
parm = build_decl (PARM_DECL, name, type);
DECL_ARTIFICIAL (parm) = 1;
+ /* All our artificial parms are implicitly `const'; they cannot be
+ assigned to. */
+ TREE_READONLY (parm) = 1;
DECL_ARG_TYPE (parm) = type;
return parm;
}
anything with a CONSTRUCTOR for arrays here, as that would imply
copy-initialization. */
return NULL_TREE;
- else if (AGGREGATE_TYPE_P (type))
+ else if (AGGREGATE_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
{
/* This is a default initialization of an aggregate, but not one of
non-POD class type. We cleverly notice that the initialization
--- /dev/null
+// Test that we allow simple throw specs on pointers.
+
+void f() throw () { }
+void (*pf)() throw () = f;
+
+struct A
+{
+ void g() throw () { }
+ static void (A::*pmf)() throw ();
+};
+
+void (A::* A::pmf)() = &A::g;
+
+int main()
+{
+ pf ();
+ A a;
+ (a.*A::pmf)();
+}