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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to