llvm-project/clang/test/SemaCXX/dllimport-memptr.cpp
Reid Kleckner cd016d8dc6 [MS] Don't statically initialize dllimport member function pointers
Summary:
r306137 made dllimport pointers to member functions non-constant. This
is correct because a load must be executed to resolve any dllimported
data. However, r306137 did not account for the use of dllimport member
function pointers used as template arguments.

This change re-lands r306137 with a template instantiation fix.

This fixes PR33570.

Reviewers: rnk, majnemer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D34714

llvm-svn: 307446
2017-07-07 22:04:29 +00:00

8 lines
244 B
C++

// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -verify -std=c++11 %s
// expected-no-diagnostics
struct __declspec(dllimport) Foo { int get_a(); };
template <int (Foo::*Getter)()> struct HasValue { };
HasValue<&Foo::get_a> hv;