Skip to content

Commit

Permalink
Structs with hyperobject members can not be treated as aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
VoxSciurorum committed Jan 2, 2024
1 parent 313115c commit 63c8023
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/DeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,9 @@ void CXXRecordDecl::addedMember(Decl *D) {
}

if (T->isHyperobjectType()) {
// Do not allow braced list initialization, which would
// suppress hyperobject registration.
data().Aggregate = false;
data().HasIrrelevantDestructor = false;
data().HasTrivialSpecialMembers &= ~SMF_Destructor;
data().HasTrivialSpecialMembersForCall &= ~SMF_Destructor;
Expand Down
14 changes: 14 additions & 0 deletions clang/test/Cilk/hyper-init-error.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 %s -fopencilk -verify -fsyntax-only
extern void id(void *), reduce(void *, void *);
struct one_hyperobject {
// expected-note@-1{{implicit copy}}
// expected-note@-2{{implicit move}}
// expected-note@-3{{implicit default}}
int _Hyperobject(id, reduce) field;
};

// braced initializer lists do not work
one_hyperobject h1 = {-1};
// expected-error@-1{{no matching constructor for initialization}}

one_hyperobject h2;

0 comments on commit 63c8023

Please sign in to comment.