[clang] [HLSL] Add test for export function redeclaration (PR #97370)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 18:31:56 PDT 2024


https://github.com/hekota created https://github.com/llvm/llvm-project/pull/97370

Related to llvm/llvm-project#92812

>From 21a7e8bc992ff6e743d0a027469a83e24c48c1d2 Mon Sep 17 00:00:00 2001
From: Helena Kotas <hekotas at microsoft.com>
Date: Mon, 1 Jul 2024 18:30:20 -0700
Subject: [PATCH] [HLSL] Add test for export function redeclaration

---
 clang/test/SemaHLSL/export.hlsl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/clang/test/SemaHLSL/export.hlsl b/clang/test/SemaHLSL/export.hlsl
index 9c624d6142232..2d19fa561fa0a 100644
--- a/clang/test/SemaHLSL/export.hlsl
+++ b/clang/test/SemaHLSL/export.hlsl
@@ -35,6 +35,12 @@ static void f9(); // expected-error {{static declaration of 'f9' follows non-sta
 static void f10(); // expected-note {{previous declaration is here}}
 export void f10(); // expected-error {{cannot export redeclaration 'f10' here since the previous declaration has internal linkage}}
 
+export void f11();
+void f11() {}
+
+void f12();           //   expected-note{{previous declaration is here}}
+export void f12() {}  //   expected-error{{cannot export redeclaration 'f12' here since the previous declaration is not exported}}
+
 export float V1; // expected-error {{export declaration can only be used on functions}}
 
 static export float V2; // expected-error{{expected unqualified-id}}



More information about the cfe-commits mailing list