https://bugs.llvm.org/show_bug.cgi?id=36374

            Bug ID: 36374
           Summary: redifinition of friend function doesn't result in
                    error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: timshe...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

template <typename Derived>
struct A {
  friend Derived operator+(const Derived& a, const Derived& b) {
    return Derived(a, b);
  }
};

struct B : A<B> {
  B() = default;
  B(B, B) {}

  friend B operator+(const B& a, const B& b) { return B(a, b); }
};

void Foo() {
  B a, b, c = a + b;
  (void)c;
}


The example above should not compile, as there are two definitions for the
operator+.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to