blob: 7e64a2924c99a9df5592ad3651c50c47030e5b4e [file] [log] [blame]
Reid Klecknerb00a49d2019-09-12 17:55:48 +00001// 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
4
5// MSVC emits this error too.
6const int __declspec(selectany) test1 = 0; // expected-error {{'selectany' can only be applied to data items with external linkage}}
7
8extern const int test2;
9const int test2 = 42; // expected-note {{previous definition is here}}
10extern __declspec(selectany) const int test2; // expected-warning {{attribute declaration must precede definition}}
11
12extern const int test3;
13const int __declspec(selectany) test3 = 42; // Standard usage.
14
15struct Test4 {
16 static constexpr int sdm = 0;
17};
18__declspec(selectany) constexpr int Test4::sdm; // no warning