[cfe-dev] __declspec(dllimport) strangeness

Eric Niebler eric at boostpro.com
Sat Dec 4 20:18:44 PST 2010


On 12/3/2010 2:20 PM, Roger Lawrence wrote:
> Hi Eric
> 
> Ignoring (and removing) the attribute seems right to me in this case. But I
> just wanted to point out that MSVC behaves differently if inline is used:
> 
> void __declspec(dllimport) foo12(); 
> inline void foo12(){}
> 
> In this case, the MS compiler ignores the discrepancy, and also ignores the
> body of foo12 - emitting a reference to an external instead.

That's just weird. One has to wonder if it's by design. Is clang to be
bug-for-bug compatible with the MS compiler for these MS-specific
extensions? IMO, it would be better if this were an error.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com



More information about the cfe-dev mailing list