27 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -fms-extensions -verify %s2// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsyntax-only -fms-extensions -verify %s -DMSVC3 4// Export const variable.5 6#ifdef MSVC7// expected-error@+4 {{'j' must have external linkage when declared 'dllexport'}}8#else9// expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}10#endif11__declspec(dllexport) int const j; // expected-error {{default initialization of an object of const type 'const int'}}12 13// With typedef14typedef const int CInt;15 16#ifdef MSVC17// expected-error@+4 {{'j2' must have external linkage when declared 'dllexport'}}18#else19// expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}20#endif21__declspec(dllexport) CInt j2; //expected-error {{default initialization of an object of const type 'CInt'}}22 23#ifndef MSVC24// expected-warning@+2 {{__declspec attribute 'dllexport' is not supported}}25#endif26__declspec(dllexport) CInt j3 = 3;27