Skip to content

Commit

Permalink
HyperobjectType needs to copy dependence flags from parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
VoxSciurorum authored and neboat committed Dec 15, 2023
1 parent 3d3c7bb commit aee817f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,9 @@ HyperobjectType::HyperobjectType(QualType Element, QualType CanonicalPtr,
IdentityID(ifn), ReduceID(rfn) {
if (Element->isIncompleteType()) // diagnosed in caller
addDependence(TypeDependence::Error);
addDependence(Element->getDependence());
addDependence(toTypeDependence(i->getDependence()));
addDependence(toTypeDependence(r->getDependence()));
}

bool HyperobjectType::hasCallbacks() const {
Expand Down
26 changes: 26 additions & 0 deletions clang/test/Cilk/222.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// RUN: %clang_cc1 %s -x c++ -fopencilk -emit-llvm -verify -mllvm -use-opencilk-runtime-bc=false -mllvm -debug-abi-calls -o /dev/null
#define DEPTH 3
template<int N> struct R {
static void identity(void *);
static void reduce(void *, void *);
int get(int depth) { return depth <= 0 ? i : field.get(depth - 1); }
public:
R<N - 1> field;
// expected-note@-1{{in instantiation}}
// expected-note@-2{{in instantiation}}
// expected-note@-3{{in instantiation}}
int _Hyperobject(identity, reduce) i;
// expected-warning@-1{{reducer callbacks not implemented for structure members}}
// expected-warning@-2{{reducer callbacks not implemented for structure members}}
// expected-warning@-3{{reducer callbacks not implemented for structure members}}
};

template<> struct R<0> { int field; int get(int) { return field; } };

extern R<DEPTH> r;

int f() { return r.get(DEPTH / 2); }
// expected-note@-1{{in instantiation}}
// expected-note@-2{{in instantiation}}
// expected-note@-3{{in instantiation}}

0 comments on commit aee817f

Please sign in to comment.