[LLVMbugs] [Bug 20512] New: clang drops dllimport attribute from qualified friend declaration of imported function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 1 14:04:48 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20512

            Bug ID: 20512
           Summary: clang drops dllimport attribute from qualified friend
                    declaration of imported function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: hans at chromium.org
          Reporter: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu, rnk at google.com
    Classification: Unclassified

Consider this example:

  __declspec(dllimport) void f();
  struct S {
    friend void ::f();
    S() { f(); };
  };
  S s;

Clang warns about the redeclaration of 'f' and drops the dllimport attribute
(MinGW does the same). MSVC on the other hand accepts this code, and treats 'f'
as an imported function.

It is interesting to note that the qualifier in the friend declaration is
significant. In the same example without qualifier:

  __declspec(dllimport) void f();
  struct S {
    friend void f();
    S() { f(); };
  };
  S s;

MSVC warns about the inconsistent dll linkage, and does not treat 'f' as
imported.

The latter example suggests that it is sensible to warn here, and MSVC not
warning in the qualified case might be a glitch. If that's the case, I'm not
sure we want to replicate that behaviour.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140801/71e6145f/attachment.html>


More information about the llvm-bugs mailing list