From 6561391053ba2989497e4a71b69184e62ba0d769 Mon Sep 17 00:00:00 2001 From: Evan Ramos Date: Tue, 12 Feb 2019 14:55:41 -0600 Subject: [PATCH] charmxi: Throw an error when declaring a constructor as [threaded] Change-Id: I4eb31f4178200a1fbdcfc08d429ba4028dc495ea --- src/xlat-i/xi-Entry.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xlat-i/xi-Entry.C b/src/xlat-i/xi-Entry.C index c44ac66720..5c42a75199 100644 --- a/src/xlat-i/xi-Entry.C +++ b/src/xlat-i/xi-Entry.C @@ -2324,6 +2324,9 @@ void Entry::genClosure(XStr& decls, bool isDef) { // It ends the current procedure with a call to awaken another thread, // and defines the thread function to handle that call. XStr Entry::callThread(const XStr& procName, int prependEntryName) { + if (isConstructor() || isMigrationConstructor()) + die("Constructors may not be 'threaded'", first_line_); + XStr str, procFull; procFull << "_callthr_"; if (prependEntryName) procFull << name << "_"; @@ -2342,8 +2345,9 @@ XStr Entry::callThread(const XStr& procName, int prependEntryName) { str << makeDecl("void") << "::" << procFull << "(CkThrCallArg *impl_arg)\n"; str << "{\n"; str << " void *impl_msg = impl_arg->msg;\n"; - str << " " << container->baseName() << " *impl_obj = (" << container->baseName() - << " *) impl_arg->obj;\n"; + str << " void *impl_obj_void = impl_arg->obj;\n"; + str << " " << container->baseName() << " *impl_obj = static_cast<" + << container->baseName() << " *>(impl_obj_void);\n"; str << " delete impl_arg;\n"; return str; } -- 2.11.4.GIT