Index: cfe/trunk/include/clang/Basic/Attr.td =================================================================== --- cfe/trunk/include/clang/Basic/Attr.td +++ cfe/trunk/include/clang/Basic/Attr.td @@ -2351,9 +2351,8 @@ let Documentation = [DLLImportDocs]; } -def SelectAny : InheritableAttr { - let Spellings = [Declspec<"selectany">]; - let LangOpts = [MicrosoftExt]; +def SelectAny : InheritableAttr, TargetSpecificAttr { + let Spellings = [Declspec<"selectany">, GCC<"selectany">]; let Documentation = [Undocumented]; } Index: cfe/trunk/test/Sema/attr-selectany.c =================================================================== --- cfe/trunk/test/Sema/attr-selectany.c +++ cfe/trunk/test/Sema/attr-selectany.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fms-compatibility -fms-extensions -verify %s +// RUN: %clang_cc1 -triple x86_64-win32 -fdeclspec -verify %s +// RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s extern __declspec(selectany) const int x1 = 1; // no warning, const means we need extern in C++ Index: cfe/trunk/test/SemaCXX/attr-selectany.cpp =================================================================== --- cfe/trunk/test/SemaCXX/attr-selectany.cpp +++ cfe/trunk/test/SemaCXX/attr-selectany.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple x86_64-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s // MSVC produces similar diagnostics. __declspec(selectany) void foo() { } // expected-error{{'selectany' can only be applied to data items with external linkage}}