2010-09-15 Jason Merrill <jason@redhat.com>
+ * semantics.c (finish_id_expression): Diagnose use of function
+ parms in evaluated context outside function body.
+
* decl2.c (grokbitfield): Diagnose non-integral width.
* call.c (convert_like_real): Use the underlying type of the
return error_mark_node;
}
}
+
+ /* Also disallow uses of function parameters outside the function
+ body, except inside an unevaluated context (i.e. decltype). */
+ if (TREE_CODE (decl) == PARM_DECL
+ && DECL_CONTEXT (decl) == NULL_TREE
+ && !cp_unevaluated_operand)
+ {
+ error ("use of parameter %qD outside function body", decl);
+ return error_mark_node;
+ }
}
/* If we didn't find anything, or what we found was a type,
2010-09-15 Jason Merrill <jason@redhat.com>
+ * g++.dg/parse/parameter-declaration-2.C: New.
+
* g++.dg/cpp0x/scoped_enum2.C: New.
2010-09-15 Eric Botcazou <ebotcazou@adacore.com>