@@ -3950,23 +3950,13 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
39503950 }
39513951
39523952 // Default inits the type, then calls the init-method in the body.
3953- // A type may not have a public default constructor as per its spec so
3954- // typically if this is the case the default constructor will be private and
3955- // in such cases we must manually override the access specifier from private
3956- // to public just for the duration of this default initialization.
39573953 bool handleSpecialType (FieldDecl *FD, QualType Ty) {
3958- const auto *RecordDecl = Ty->getAsCXXRecordDecl ();
3959- AccessSpecifier DefaultConstructorAccess;
3960- auto DefaultConstructor =
3961- std::find_if (RecordDecl->ctor_begin (), RecordDecl->ctor_end (),
3962- [](auto it) { return it->isDefaultConstructor (); });
3963- DefaultConstructorAccess = DefaultConstructor->getAccess ();
3964- DefaultConstructor->setAccess (AS_public);
39653954 addFieldInit (FD, Ty, std::nullopt ,
39663955 InitializationKind::CreateDefault (KernelCallerSrcLoc));
3967- DefaultConstructor-> setAccess (DefaultConstructorAccess);
3956+
39683957 addFieldMemberExpr (FD, Ty);
39693958
3959+ const auto *RecordDecl = Ty->getAsCXXRecordDecl ();
39703960 createSpecialMethodCall (RecordDecl, getInitMethodName (), BodyStmts);
39713961 CXXMethodDecl *FinalizeMethod =
39723962 getMethodByName (RecordDecl, FinalizeMethodName);
0 commit comments