https://bugs.llvm.org/show_bug.cgi?id=33570
Bug ID: 33570
Summary: Clang incorrectly considers dllimport pointers to
member functions to be valid constant initializers
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: r...@google.com
CC: llvm-bugs@lists.llvm.org
Consider:
struct __declspec(dllimport) Foo { void f(); };
auto global_fp = &Foo::f;
This generates the following LLVM IR global:
declare dllimport void @"\01?f@Foo@@QEAAXXZ"(%struct.Foo*) #0
@"\01?global_fp@@3P8Foo@@EAAXXZEQ1@" = global i8* bitcast (void (%struct.Foo*)*
@"\01?f@Foo@@QEAAXXZ" to i8*), align 8
This means that 'global_fp' will contain the import thunk for Foo::f, and not
the actual address of Foo::f in the DLL that exports it.
This is basically another instance of
https://bugs.llvm.org//show_bug.cgi?id=20130.
The solution is to teach Sema that a dllimported member function pointer is not
constant, and to emit a dynamic initializer instead.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs