Skip to content

Commit 55d4311

Browse files
Fix CodeGenSYCL/template-template-parameter.cpp
1 parent 7cd339d commit 55d4311

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,7 @@ class SYCLKernelNameTypeVisitor
28522852
if (T->isNullPtrType())
28532853
S.Diag(KernelInvocationFuncLoc, diag::err_sycl_kernel_incorrectly_named)
28542854
<< /* kernel name cannot be a type in the std namespace */ 3;
2855+
IsInvalid = true;
28552856
return;
28562857
}
28572858
// If KernelNameType has template args visit each template arg via
@@ -2890,21 +2891,23 @@ class SYCLKernelNameTypeVisitor
28902891
void VisitTagDecl(const TagDecl *Tag) {
28912892
bool UnnamedLambdaEnabled =
28922893
S.getASTContext().getLangOpts().SYCLUnnamedLambda;
2893-
const DeclContext *DC = Tag->getDeclContext();
2894-
if (DC && !UnnamedLambdaEnabled) {
2895-
auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);
2896-
if (NS && NS->isStdNamespace()) {
2894+
const DeclContext *DeclCtx = Tag->getDeclContext();
2895+
if (DeclCtx && !UnnamedLambdaEnabled) {
2896+
auto *NameSpace = dyn_cast_or_null<NamespaceDecl>(DeclCtx);
2897+
if (NameSpace && NameSpace->isStdNamespace()) {
28972898
S.Diag(KernelInvocationFuncLoc, diag::err_sycl_kernel_incorrectly_named)
28982899
<< /* kernel name cannot be a type in the std namespace */ 3;
28992900
IsInvalid = true;
2901+
return;
29002902
} else {
2901-
if (!DC->isTranslationUnit() && !isa<NamespaceDecl>(DC)) {
2903+
if (!DeclCtx->isTranslationUnit() && !isa<NamespaceDecl>(DeclCtx)) {
29022904
const bool KernelNameIsMissing = Tag->getName().empty();
29032905
if (KernelNameIsMissing) {
29042906
S.Diag(KernelInvocationFuncLoc,
29052907
diag::err_sycl_kernel_incorrectly_named)
29062908
<< /* kernel name is missing */ 0;
29072909
IsInvalid = true;
2910+
return;
29082911
} else {
29092912
if (Tag->isCompleteDefinition()) {
29102913
S.Diag(KernelInvocationFuncLoc,

clang/test/CodeGenSYCL/template-template-parameter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsycl-int-header=%t.h %s
1+
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsycl-int-bb=%t.h -sycl-std=2020 %s
22
// RUN: FileCheck -input-file=%t.h %s
33

44
#include "Inputs/sycl.hpp"

0 commit comments

Comments
 (0)