brintos

brintos / llvm-project-archived public Read only

0
0
Text · 813 B · 7e64a29 Raw
19 lines · cpp
1// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-windows-msvc -fdeclspec -verify2// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-windows-msvc -fdeclspec -verify3// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-scei-ps4 -fdeclspec -verify4 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 warning19