[LLVMbugs] [Bug 18432] New: befriending a member function of a nested class hides its default arguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 9 16:05:47 PST 2014


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

            Bug ID: 18432
           Summary: befriending a member function of a nested class hides
                    its default arguments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rjmccall at apple.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

usury:clang$ cat /tmp/red.cpp
struct A {
  struct B {
    B(int x = 0) {}
    void foo(int x = 0);
  };
  friend B::B(int);
  friend void B::foo(int);
};

void test() {
  A::B b;
  b.foo();
}

usury:clang$ clang -fsyntax-only /tmp/red.cpp
/tmp/red.cpp:11:8: error: no matching constructor for initialization of 'A::B'
  A::B b;
       ^
/tmp/red.cpp:6:13: note: candidate constructor not viable: requires 1 argument,
but 0 were provided
  friend B::B(int);
            ^
1 error generated.

usury:clang$ sed -i -e 's at friend B@//friend B@' /tmp/red.cpp
usury:clang$ clang -fsyntax-only /tmp/red.cpp
tmp/red.cpp:12:9: error: too few arguments to function call, expected 1, have 0
  b.foo();
  ~~~~~ ^
/tmp/red.cpp:7:3: note: 'foo' declared here
  friend void B::foo(int);
  ^
1 error generated.



These friend declarations are useless --- members of a nested class
automatically have friend-level access to the class --- but they shouldn't
interfere with the default arguments.

-- 
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/20140110/a66f2c12/attachment.html>


More information about the llvm-bugs mailing list