[LLVMbugs] [Bug 6754] New: incorrect parsing of friend declaration with a ::

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 31 14:06:33 PDT 2010


           Summary: incorrect parsing of friend declaration with a ::
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

gcc accepts but clang rejects:

struct C {
  enum bar { foo };
C::bar zed();
class D {
  friend C::bar ::zed();

the error message

test.ii:6:13: error: expected a class or namespace
  friend C::bar ::zed();
test.ii:6:19: error: C++ requires a type specifier for all declarations
  friend C::bar ::zed();
  ~~~~~~          ^

suggest that clang is trying to parse the return type of zed as the class we
are declaring friendship with.

Removing the :: before zed makes clang accept the code.

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