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

            Bug ID: 45256
           Summary: Formatting damages friend declaration for
                    specialization of operator function template
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: ca...@carter.net
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 23263
  --> https://bugs.llvm.org/attachment.cgi?id=23263&action=edit
Minimal repro

Formatting this C++ program with clang-format (i.e., using the default style):

  template <class> class S;

  template <class T> bool operator<(S<T> const &x, S<T> const &y) {
    return x.i < y.i;
  }

  template <class T> class S {
    int i = 42;
    friend bool operator< <>(S const &, S const &);
  };

  int main() { return S{} < S{}; }

Transforms the well-formed friend declaration into the ill-formed:

    friend bool operator<<>(S const &, S const &);

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

Reply via email to