Skip to content

Commit 6ca8af6

Browse files
committed
[SYCL] Allow pre-declared C++ classes to be used without being defined
Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 19e5168 commit 6ca8af6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
250250
Ty = QualType{Ty->getPointeeOrArrayElementType(), 0};
251251

252252
if (const auto *CRD = Ty->getAsCXXRecordDecl()) {
253+
// FIXME: this seems like a temporary fix for SYCL programs
254+
// that pre-declare, use, but not define OclCXX classes,
255+
// which are later translated into SPIRV types.
256+
if(!CRD->hasDefinition())
257+
return true;
258+
253259
if (CRD->isPolymorphic()) {
254260
SemaRef.Diag(CRD->getLocation(), diag::err_sycl_virtual_types);
255261
SemaRef.Diag(Loc.getBegin(), diag::note_sycl_used_here);

0 commit comments

Comments
 (0)