[LLVMbugs] [Bug 7230] New: extern "C" global function can't be made a friend of a class in a namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 25 13:18:20 PDT 2010


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

           Summary: extern "C" global function can't be made a friend of a
                    class in a namespace
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bruce.r.stephens at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=4931)
 --> (http://llvm.org/bugs/attachment.cgi?id=4931)
Non-working example

(Or at least, not easily.)

I get these errors:

nt.cc:10:19: error: no function named 'F' with type 'void ()' was found in the
specified scope
    friend void ::F(void);
                  ^
nt.cc:15:11: error: 'foo' is a private member of 'N::C'
  N::bar->foo();
          ^
nt.cc:9:10: note: declared private here
    void foo(void);
         ^
2 errors generated.

If the function F() is in the namespace (or if everything's global) there's no
problem.

gcc accepts the code.  This is a stripped example from the real code which is
accepted by VS, Sun Studio (or whatever it's called now) and HP-UX's compiler.

(The code may well still be incorrect, but if it is I'm not sure why.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list