63 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -verify2 3export void f1();4 5export void f1() {}6 7namespace { // expected-note {{anonymous namespace begins here}}8 export void f2(); // expected-error {{export declaration appears within anonymous namespace}}9}10 11export void f3();12 13export { // expected-note {{export block begins here}}14 void f4() {}15 export void f5() {} // expected-error {{export declaration appears within another export declaration}}16 int A; // expected-error {{export declaration can only be used on functions}}17 namespace ns { // expected-error {{export declaration can only be used on functions}}18 void f6();19 }20}21 22export { // expected-note {{export block begins here}}23 export { // expected-error {{export declaration appears within another export declaration}}24 void f();25 }26}27 28void export f7() {} // expected-error {{expected unqualified-id}}29 30export static void f8() {} // expected-error {{declaration of 'f8' with internal linkage cannot be exported}}31 32export void f9(); // expected-note {{previous declaration is here}}33static void f9(); // expected-error {{static declaration of 'f9' follows non-static declaration}}34 35static void f10(); // expected-note {{previous declaration is here}}36export void f10(); // expected-error {{cannot export redeclaration 'f10' here since the previous declaration has internal linkage}}37 38export void f11();39void f11() {}40 41void f12(); // expected-note{{previous declaration is here}}42export void f12() {} // expected-error{{cannot export redeclaration 'f12' here since the previous declaration is not exported}}43 44export float V1; // expected-error {{export declaration can only be used on functions}}45 46static export float V2; // expected-error{{expected unqualified-id}}47 48export static float V3 = 0; // expected-error {{export declaration can only be used on functions}}49 50export groupshared float V4; // expected-error {{export declaration can only be used on functions}}51 52void f6() {53 export int i; // expected-error {{expected expression}}54}55 56export cbuffer CB { // expected-error {{export declaration can only be used on functions}}57 int a;58}59 60export template<typename T> void tf1(T t) {} // expected-error {{export declaration can only be used on functions}}61 62void f5() export {} // expected-error {{expected function body after function declarator}}63