+2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR c++/94752
+ * coroutines.cc (morph_fn_to_coro): Ensure that
+ unnamed function params have a usable and distinct
+ frame field name.
+
2020-04-24 Jason Merrill <jason@redhat.com>
PR c++/94583
when we see uses. */
param_uses = new hash_map<tree, param_info>;
+ unsigned no_name_parm = 0;
for (tree arg = DECL_ARGUMENTS (orig); arg != NULL;
arg = DECL_CHAIN (arg))
{
parm.frame_type = actual_type;
parm.this_ptr = is_this_parameter (arg);
parm.trivial_dtor = TYPE_HAS_TRIVIAL_DESTRUCTOR (parm.frame_type);
- tree pname = DECL_NAME (arg);
- char *buf = xasprintf ("__parm.%s", IDENTIFIER_POINTER (pname));
+ char *buf;
+ if (DECL_NAME (arg))
+ {
+ tree pname = DECL_NAME (arg);
+ buf = xasprintf ("__parm.%s", IDENTIFIER_POINTER (pname));
+ }
+ else
+ buf = xasprintf ("__unnamed_parm.%d", no_name_parm++);
parm.field_id = coro_make_frame_entry
(&field_list, buf, actual_type, DECL_SOURCE_LOCATION (arg));
free (buf);
--- /dev/null
+// { dg-additional-options "-w" }
+
+#include "coro.h"
+
+using namespace std;
+
+struct task {
+ struct promise_type {
+ promise_type() {}
+ task get_return_object() { return {}; }
+ suspend_never initial_suspend() { return {}; }
+ suspend_never final_suspend() { return {}; }
+ void return_void() {}
+ void unhandled_exception() {}
+ };
+};
+
+task foo(int) {
+ co_return;
+}