[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / declspec-selectany.cpp
blob7e64a2924c99a9df5592ad3651c50c47030e5b4e
1 // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-windows-msvc -fdeclspec -verify
2 // RUN: %clang_cc1 -std=c++17 %s -triple x86_64-windows-msvc -fdeclspec -verify
3 // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-scei-ps4 -fdeclspec -verify
5 // MSVC emits this error too.
6 const int __declspec(selectany) test1 = 0; // expected-error {{'selectany' can only be applied to data items with external linkage}}
8 extern const int test2;
9 const int test2 = 42; // expected-note {{previous definition is here}}
10 extern __declspec(selectany) const int test2; // expected-warning {{attribute declaration must precede definition}}
12 extern const int test3;
13 const int __declspec(selectany) test3 = 42; // Standard usage.
15 struct Test4 {
16 static constexpr int sdm = 0;
18 __declspec(selectany) constexpr int Test4::sdm; // no warning