Skip to content

Commit

Permalink
[SYCL] Allow pre-declared C++ classes to be used without being defined
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
  • Loading branch information
vladimirlaz committed Jan 22, 2019
1 parent 19e5168 commit 6ca8af6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
Ty = QualType{Ty->getPointeeOrArrayElementType(), 0};

if (const auto *CRD = Ty->getAsCXXRecordDecl()) {
// FIXME: this seems like a temporary fix for SYCL programs
// that pre-declare, use, but not define OclCXX classes,
// which are later translated into SPIRV types.
if(!CRD->hasDefinition())
return true;

if (CRD->isPolymorphic()) {
SemaRef.Diag(CRD->getLocation(), diag::err_sycl_virtual_types);
SemaRef.Diag(Loc.getBegin(), diag::note_sycl_used_here);
Expand Down

0 comments on commit 6ca8af6

Please sign in to comment.