https://llvm.org/bugs/show_bug.cgi?id=24215
Bug ID: 24215
Summary: Downgrade "redeclaration cannot add dllimport" error
to a warning
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
In the following code:
extern "C" void sleep(unsigned ms);
void f() {
sleep(1000);
}
extern "C" __declspec(dllimport) void sleep(unsigned ms);
Clang will error:
/tmp/a.cc:7:39: error: redeclaration of 'sleep' cannot add 'dllimport'
attribute
extern "C" __declspec(dllimport) void sleep(unsigned ms);
^
/tmp/a.cc:1:17: note: previous declaration is here
extern "C" void sleep(unsigned ms);
^
The problem is that Clang will already have generated IR for the sleep()
declaration after emitting f().
Because the IR has already been generated, the 'dllimport' attribute won't be
added and the compiler errors.
In practice, this code would still work as it will link against the thunk for
sleep(). Pointer identity will be broken, but that is probably not serious
enough to error about.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs