[Bug c++/34749] Incorrect warning when applying dllimport to friend function

dannysmith at users dot sourceforge dot net gcc-bugzilla@gcc.gnu.org
Sun Jan 13 10:24:00 GMT 2008



------- Comment #3 from dannysmith at users dot sourceforge dot net  2008-01-13 06:50 -------
(In reply to comment #1)
> One could make the argument that the dllimport specifier is
> a storage-class-specifier which, per 11.4/6 is not allowed on
> the friend declaration. Since a friend function declaration
> needs to be preceded by a declaration of the function itself,
> it will always be sufficient if the dllimport specifier is only
> on the original function declaration.
> 

MS semantics for dllimport for ordinary file scope functions, is that if a
declaration with dllimport attribute is followed by a decl without, the prior
dllimport is overriden.  Hence, the warning that Stephen shows for df3.cc  in
comment #3 may make some sense, but I do not have a MS compiler handy to see
what MS says for the friend case.  The warning does not make sense, if the 
dllimport attribute is actually honoured (as it should be) in original
testcase.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34749



More information about the Gcc-bugs mailing list