[PATCH] D53870: [clang-cl] Put dllexport attrs on static locals also in template instantiations (PR39496)
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 31 03:11:01 PDT 2018
hans added a comment.
Bah, I should have known something was going to break if I touched this :-)
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/37132
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1017
Here's a repro:
template <typename T> struct __declspec(dllimport) S {
void foo() {
static constexpr char src[] = {"hello"};
T arr[sizeof(src)];
}
};
void use() {
S<int> s;
s.foo();
}
$ bin/clang -target i686-pc-win32 -c /tmp/a.cc
/tmp/a.cc:4:17: error: invalid application of 'sizeof' to an incomplete type 'char const[]'
T arr[sizeof(src)];
^~~~~
/tmp/a.cc:10:5: note: in instantiation of member function 'S<int>::foo' requested here
s.foo();
^
1 error generated.
This is annoying. Looking into it now.
Repository:
rC Clang
https://reviews.llvm.org/D53870
More information about the cfe-commits
mailing list