================
@@ -53,3 +53,14 @@ extern const SomeStruct some_struct;
 
 // Without selectany, this should stay an error.
 const SomeStruct some_struct2; // expected-error {{default initialization of 
an object of const type 'const SomeStruct' without a user-provided default 
constructor}}
+
+struct __declspec(selectany) S1 {}; // expected-error {{'selectany' attribute 
only applies to global variables}}
+__declspec(selectany) struct S1 s1;
+
+void t() {
+  __declspec(selectany) int x; // expected-error {{'selectany' attribute only 
applies to global variables}}
+  __declspec(selectany) extern int y;
+}
+
+struct S2 {};
+struct __declspec(selectany) S2 s2; // expected-error {{'selectany' attribute 
only applies to global variables}}
----------------
a-tarasyuk wrote:

@AaronBallman @erichkeane Could you advise on the preferred approach here? 
Would it make sense to file an issue for these cases to get more clarification 
first?

https://github.com/llvm/llvm-project/pull/189641
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to