mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 14:06:39 +00:00

Previously dllimport variables inside of template arguments relied on not using the C++11 codepath when -fms-compatibility was set. While this allowed us to achieve compatibility with MSVC, it did so at the expense of MingW. Instead, try to use the DeclRefExpr we dig out of the template argument. If it has the dllimport attribute, accept it and skip the C++11 null-pointer check. llvm-svn: 211766
17 lines
501 B
C++
17 lines
501 B
C++
// RUN: %clang_cc1 -triple i686-win32 -verify -std=c++11 %s
|
|
// RUN: %clang_cc1 -triple i686-mingw32 -verify -std=c++11 %s
|
|
|
|
extern int __attribute__((dllimport)) var;
|
|
constexpr int *varp = &var; // expected-error {{must be initialized by a constant expression}}
|
|
|
|
extern __attribute__((dllimport)) void fun();
|
|
constexpr void (*funp)(void) = &fun; // expected-error {{must be initialized by a constant expression}}
|
|
|
|
template <void (*)()>
|
|
struct S {};
|
|
S<&fun> x;
|
|
|
|
template <int *>
|
|
struct U {};
|
|
U<&var> y;
|