[PATCH] Sema: Treat dllimport globals without explicit storage class as extern

Nico Rieck nico.rieck at gmail.com
Wed Feb 26 16:07:39 PST 2014


On 27.02.2014 00:45, Gao, Yunzhong wrote:
> Thanks for clarifying. So with your patch, what is the expected compiler behaviour on the
> following snippet?
> __declspec(dllimport) int v;
> int v;
> 
> From your test case it seems that I will get a compile-time error "definition of dllimport data",
> but when I test this out on Visual Studio 2012, I got only a warning:
> warning C4273: inconsistent dll linkage

MSVC has surprising behavior here and actually makes v dllexport. I
don't plan to implement this. But this should at least warn about the
ignored dllimport attribute. The following patch deals with
redeclarations and properly diagnoses this (including dllexport).

> I take this to mean, more tests are coming? If so, it is fine with me.

Yes.

-Nico



More information about the cfe-commits mailing list